Click to See Complete Forum and Search --> : Pass value to function of a form


arthur
11-04-2003, 10:01 AM
I am trying to pass a value via a function to update a text field of a form. But I get an error (Expected opject) on the function call. Can someone help. Below is the code snipit ...


<script language="JavaScript" type="text/javascript">
var addIt = '';
function addToIt(addIt)
{
Calculator.InputBox.value += addIt";
}

</script>
</head>

<body>
<form name="Calculator">
<table>
<tr>
<td><INPUT TYPE="text" NAME="InputBox"></td>
</tr>
<tr>
<td align="center"><INPUT TYPE="button" NAME="bOne" VALUE=" 1 " onClick="addToIt('1')"></td>

requestcode
11-04-2003, 11:44 AM
Try changing this line:
Calculator.InputBox.value += addIt";

To this:
document.Calculator.InputBox.value += addIt;

You could also change your call to the function to this:

<INPUT TYPE="button" NAME="bOne" VALUE="1" onClick="addToIt(this.value)">

arthur
11-04-2003, 12:11 PM
Thanks! that did it...