Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > Other Programming Languages
|
Other Programming Languages If you have a coding issue to discuss about another language that really isn't provided for in any other forum here (not ASP.NET C#, C++, VB, PHP, JavaScript, Python, Java, Perl, Applescript, XML or any of the other forum topics we have), post it here. Enough discussion on a language we don't have covered could prompt a new forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Other Programming Languages section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 15th, 2006, 09:46 AM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default insert text into a text box by selecting an link

Hello,

Wondering if anyone can help.

I have been trying to insert text into a form text box by clicking on links using javascript, but have been having issues with this.

Currently i have 4 links with the values 1..4. When i click on one of the links, their value is entered into the text box in the form. Therefore selecting link 1 will insert the number 1 into the form.

Where i am having the problem is that if i want to insert multiple numbers into the textbox (i.e. 112114) the previous number is being overwritten by the new number selected by clicking on 1 of the other links

If anyone can help id be grateful

code as follows:

<script language='javascript' type="text/javascript">
<!-- Hide script from older browsers
        colorInfo = new Array
        colorInfo[1] = "1"
        colorInfo[2] = "2"
        colorInfo[3] = "3"
        colorInfo[4] = "4"

        function showInfo(thisColor) {
           document.frmColor.txtColor.value = colorInfo[thisColor]
        }
// End hiding script from older browsers -->
</script>

<form name="frmColor" action="/testingsurname_search.asp" method="GET" id="frmColor">
<input type="hidden" name="pagename" value="color_search">
<input name="txtColor" type="text" size="10" >
<input name="color" value="colour" type="submit">
          </form>

<a href="#" onClick="this.href='javascript:showInfo(1)';">1</a>
<a href="#" onClick="this.href='javascript:showInfo(2)'">2</a>
<a href="#" onClick="this.href='javascript:showInfo(3)'">3</a>
<a href="#" onClick="this.href='javascript:showInfo(4)'">4</a>

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing text in text box inside table Larry Landis Word VBA 0 December 27th, 2007 12:03 PM
Text Box .text Property Displays conflicting Valus JPOhlman Visual Basic 2005 Basics 3 August 23rd, 2006 02:39 PM
Can't set text property of dynamic text box sreerajrs ASP.NET 1.0 and 1.1 Professional 1 May 31st, 2006 09:39 PM
Extract text from text file & put in dropdown box tsukey Beginning PHP 5 July 20th, 2004 09:49 PM
How to insert default value if text box is empty akc Javascript How-To 2 November 7th, 2003 11:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.