Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onClick - multiple functions

Status
Not open for further replies.

camcim

Programmer
Jan 25, 2003
20
0
0
US
Hi guys,
Can anyone tell me how to place two fuctions on one onClick event. They both work fine seperately, but not together.
The code is below: (note - the code for the second function is beneath the </HTML> tag)

<HTML>
<HEAD>
<SCRIPT language=JavaScript>
function UseIt()
{

var qty = document.lotto1.ammount.value
var ship = 30
var num1 = Math.round(550 * qty)

var num2 = Math.round(num1 + ship * qty)
document.lotto1.sub1.value=num1
document.lotto1.box7.value=num2

}
</SCRIPT>

<SCRIPT type=&quot;text/javascript&quot; >
function fdp(n, d)

{ d = (d>10?10:d);
d = (d<0?0:d);
var r = &quot;&quot; + Math.round(n * Math.pow(10,d));
return (d==0?r:r.substring(0,r.length-d)+&quot;.&quot;
+r.substring(r.length-d,r.length));
}

</SCRIPT>

</HEAD>
<BODY bgColor=#ffffff>
<H3>Place a number in Qty box:</H3>
<form name=&quot;lotto1&quot;>

Qty<input type=&quot;text&quot; name=&quot;ammount&quot;>sub total<input type=&quot;text&quot; name=&quot;sub1&quot;>
<br>
$<input type=&quot;text&quot; name=&quot;ship&quot; value=&quot;30&quot; readonly>
<br>
<INPUT name=box7>

<p>
<input type=&quot;button&quot; value=&quot;Click to see results&quot; onClick=&quot;UseIt()&quot;>
</FORM>
</BODY>
</HTML>



&quot;lotto1.box7.value =
fdp(lotto1.ammount.value, 2)&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top