wanye
04-02-2003, 12: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:
<html>
<head>
<script type="text/javascript">
function num1()
{
x=document.myForm
at=x.field.value
}
</script>
</head>
<body>
<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="#">
</form>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function num1()
{
x=document.myForm
at=x.field.value
}
</script>
</head>
<body>
<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="#">
</form>
</body>
</html>