I'm trying to pass a parameter to a function and then having the function output to the textbox that called it.
Here is my calling function:
And here is my function:Code:echo "<tr><td><p class=other>" . $row[0] . "</td>"; echo "<td><p class=other><input type=text name=HourEntry" . $i ." size=10 onchange="Changehandler(i)"></td>"; echo "<td><p class=other4>" . $row2[$i + 3] . "</td>"; echo "<td><p class=other2><input type=text name=HourEntry2" . $i ." size=10></td></tr>";
I'm not sure if the function works, because I can't get the parser to get past the "Changehandler(i)" line when I call it. How do I pass the number of the textbox to the function??Code:<script language="JavaScript 1.2" type="text/javascript"> <!-- Function ChangeHandler(i) { document.dform.HourEntry2.value=(parseFloat(HourEntry" + i + ".value) - parseFloat(HourEntry2" + i + ".value)); } //--> </script>
And in case you need to understand what is going on, the echo lines are in a loop creating approx. 30 text boxes and I need to have the user type text into the first one and have it update the next one.




Reply With Quote