Hi all,
I'm trying to write a grid widget in php. When the user changes the value of
a cell the totals must be recalculated at the client side.
I can write a javascript when I use simple variables like A1, B1.
<td><input type=text name='A1' SIZE=5 MAXLENGTH=5
onChange="njrecalculate()"></td>
<td><input type=text name='B1' SIZE=5 MAXLENGTH=5
onChange="njrecalculate()"></td>
This javascript will do the trick:
function njrecalculate()
{
document.forms[0].mytot.value = Math.round(document.forms[0].A1.value)
+ Math.round(document.forms[0].B1.value) ;
}
But now I want to create a dynamice grid by using the array variable e.g.
mycell[]:
<?php
echo "<tr><td><input type=text NAME='mycel[]' SIZE=5 MAXLENGTH=5
onChange='njrecalculate()' value=$mycel[0]></td></tr>";
echo "<tr><td><input type=text NAME='mycel[]' SIZE=5 MAXLENGTH=5
onChange='njrecalculate()' value=$mycel[1]></td></tr>";
echo "<tr><td><input type=text NAME='mytotals' SIZE=5 MAXLENGTH=5
onChange='njrecalculate()' value=$mytot></td></tr>";
?>
Does anybody know how to access these mycell form fields on the client side
using javascript.
Nico Jansen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php