Forums
This topic is locked
ASP, JScript and calculations
Posted 18 Jul 2001 14:23:03
1
has voted
18 Jul 2001 14:23:03 Kevin Coster posted:
Could someone please advise on how I could re-use this code:var tp1 = FormatToHundreths(Q1.getText()*U1.getText())
{
T1.setText(tp1)
}
var v1 = FormatToHundreths(T1.getText()*(R1.getText()/100))
{
V1.setText(v1)
}
On certain events for example onChange(), onClick(), but without entering it for each event ie duplicating it.
Thanks in advance
Kevin
Replies
Replied 18 Jul 2001 22:09:31
18 Jul 2001 22:09:31 Joel Martinez replied:
put it in a function that you can call from anywhere...
<pre id=code><font face=courier size=2 id=code>function theCode() {
var tp1 = FormatToHundreths(Q1.getText()*U1.getText())
{
T1.setText(tp1)
}
var v1 = FormatToHundreths(T1.getText()*(R1.getText()/100))
{
V1.setText(v1)
}
}</font id=code></pre id=code>
that may not be exactly how you want to format the function, but you get the idea...
Joel Martinez
----------
Is this thing on?....
<pre id=code><font face=courier size=2 id=code>function theCode() {
var tp1 = FormatToHundreths(Q1.getText()*U1.getText())
{
T1.setText(tp1)
}
var v1 = FormatToHundreths(T1.getText()*(R1.getText()/100))
{
V1.setText(v1)
}
}</font id=code></pre id=code>
that may not be exactly how you want to format the function, but you get the idea...
Joel Martinez
----------
Is this thing on?....
Replied 19 Jul 2001 11:55:23
19 Jul 2001 11:55:23 Kevin Coster replied:
Thanks for that, I was thinking along those lines, just needed someone to confirm it would work !