for example this function get a value from a textbox and calculate and return the value to another textbox. this example can work.
-------------------------------------
<script type="text/javascript">
function chkBreakdown(){
myForm=document.brk
total=50*myForm.brkID.value
myForm.brk_total.value=total;
}
</script>
<html>
<body>
<form name="brk">
<input type="text" name="brkID" value="0" size="3" maxlength="3" onblur="chkBreakdown()">
<input type="text" name="brk_total">
</form>
</body>
</html>
------------------------------------------
now my problem is for example below:
Vector wp = new Vector();
Vector ln = new Vector();
<script type="text/javascript">
function chkBreakdown(wp,ln,la){
myForm=document.brk
total=wp+ln+la+*myForm.brkID<%=c%>.value <--is this correct or not?
myForm.brk_total.value=total;
}
</script>
<html>
<body>
<form name="brk">
<tr><td>LA no.</td><td>: <input type=text id="laNo" size=6 style="border:0" value='<%=la_no%>'> </td></tr>
<%for(int c=0; c<wp.size(); c++){%>
<td><input type="text" size=5 name="wp<%=c%>" value='<%=wp.elementAt(c)%>'></td>
<td><input type="text" size=4 name="ln<%=c%>" value='<%=ln.elementAt(c)%>'></td>
<td><input type="text" size=8 name="brkID<%=c%>" id="brkID" value='<%=brkID.elementAt(c)%>' onFocus="chkBreakdown('<%=wp.elementAt(c)%>','<%=ln.elementAt(c)%>','<%=la_no%>');"></td>
</form>
<input type="text" name="brk_total">
</body>
</html>



Reply With Quote

Bookmarks