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>
|