javascript respond to a php loop
Hi
Im trying to use a dynamic field and "onchange" to perform an equation and display a result on screen before the user hits submit. the problem is that the page is displayed using a php loop (the number of iterations is chosen in the preceeding page using php) so im using $i to increment the variable name. Basically what im asking is, is it possible to have the function below respond to apheight$i where $i could be anything from 1 - 4. it works if the php loop is only generated once but no more.any ideas??
Code:
<script language="javascript"> function heightauto(){ var ret = true; var height = aps.apheight$i.value; var minimum = 400; var maximum = 2450; var output2 = ""; if(height >= minimum && height <= maximum) {} else{ output2 = "Please input a height between " + minimum + "mm and " + maximum + "mm"; ret = false; } aps.alertheight.value = output2; return ret; } setInterval("heightauto()", 500); </script>
|