View Full Version : display numbers in the textfield when i click on the buttons?

04-02-2003, 01:28 PM
hi all, i am a beginner at jscript, how do i display numbers in the textfield when i click on the buttons, can someone pls help me check what's wrong with my script? thx. my code is shown below:

<script type="text/javascript">
function num1()


<form name="myForm" action="sms.htm">
<input type="text" name="field"><br>
<input type="button" name="one" value="1" onclick="num1()">
<input type="button" name="two" value="2">
<input type="button" name="three" value="3"><br>
<input type="button" name="four" value="4">
<input type="button" name="five" value="5">
<input type="button" name="six" value="6"><br>
<input type="button" name="seven" value="7">
<input type="button" name="eight" value="8">
<input type="button" name="nine" value="9"><br>
<input type="button" name="star" value="*">
<input type="button" name="zero" value="0">
<input type="button" name="hex" value="#">


04-02-2003, 03:16 PM
<script language="JavaScript1.2" type="text/javascript">
function num1(what) {
what.form.field.value += what.value;

<input type="button" name="one" value="1" onclick="num1(this)">