Forums
This topic is locked
Maths and ASP !
Posted 06 Aug 2001 17:14:25
1
has voted
06 Aug 2001 17:14:25 Adam Cronin posted:
Does anyone know how I could take a number from a form object and divide it into another from object, then display it in yet another ?For example, say I had a form with three text boxes, I type 18 in the first one, 6 in the second - and when i hit a submit button = 3 is diplayed in the third text box.
Is ASP the technology I should even be using ?
A thousand Thank You's to those who can help <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replies
Replied 06 Aug 2001 17:37:58
06 Aug 2001 17:37:58 Joel Martinez replied:
if that's all your doing... you can just use Javascript... just make sure to name your text boxes accordingly....
here's an example, you can adapt it, just make sure you change the form names:<pre id=code><font face=courier size=2 id=code><script language="javascript">
//put this in the head of the document
function dividenumbers() {
//change form1 to your form name
var f = document.form1;
var ans = f.box1.value / f.box2.value;
f.box3.value = ans;
}
</script>
Then Add the "call javascript" behavior to a button or something (not a submit button, just a regular one) and put "dividenumbers()" (without the double quotes)
that should work
</font id=code></pre id=code>
Joel Martinez
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
here's an example, you can adapt it, just make sure you change the form names:<pre id=code><font face=courier size=2 id=code><script language="javascript">
//put this in the head of the document
function dividenumbers() {
//change form1 to your form name
var f = document.form1;
var ans = f.box1.value / f.box2.value;
f.box3.value = ans;
}
</script>
Then Add the "call javascript" behavior to a button or something (not a submit button, just a regular one) and put "dividenumbers()" (without the double quotes)
that should work
</font id=code></pre id=code>
Joel Martinez
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
Replied 06 Aug 2001 18:31:47
06 Aug 2001 18:31:47 Adam Cronin replied:
It worked !
Thank-you, Thank-You, Thank-You Mr. Martinez, thats exactly what I was after !
Excellent <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Thank-you, Thank-You, Thank-You Mr. Martinez, thats exactly what I was after !
Excellent <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>