Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert number from a button into a text box

Status
Not open for further replies.

Ciaran

Technical User
Oct 18, 2001
145
GB
I would really like to know that if you click on a button it would put this value into a teaxt box then if you click on the button again it would enter the value into another text box.
 
<form name=xxx>
<input type=button value=10 onclick=&quot;if (document.xxx.textbox1.value!=null) document.xxx.textbox2.value=this.value else document.xxx.textbox1.value=this.value&quot;>
....
 
I got this code off a freesite somewhere, but I cannot remember where.


<!-- ONE STEP TO INSTALL UP & DOWN BOX:

1. Copy the coding into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the BODY of your HTML document -->

<BODY>

<center>
<form>
<input type=text name=amount value=&quot;&quot;>
<input type=button value=&quot;A&quot; onClick=&quot;javascript:this.form.amount.value+='A';&quot;>
<input type=button value=&quot;B&quot; onClick=&quot;javascript:this.form.amount.value+='B';&quot;>
<input type=button value=&quot;space&quot; onClick=&quot;javascript:this.form.amount.value+='&nbsp;';&quot;>
<input type=button value=&quot;delete&quot; onClick=&quot;javascript:this.form.amount.value.length--;&quot;>
</form>
</center>

<p><center>
<font face=&quot;arial, helvetica&quot; size=&quot;-2&quot;>Free JavaScripts provided<br>
by <a href=&quot; JavaScript Source</a></font>
</center><p>

<!-- Script Size: 0.45 KB -->

- DB

dgtlby@excite.com
Administrator

UBB Developers Network

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top