Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Getting value from function
Old 05-26-2006, 01:17 AM Getting value from function
Junior Talker

Posts: 2
Trades: 0
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)%>','<%=l n.elementAt(c)%>','<%=la_no%>');"></td>
</form>
<input type="text" name="brk_total">
</body>
</html>
melvinoyh is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Getting value from function
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40854 seconds with 12 queries