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!

Push Button Event 1

Status
Not open for further replies.

TLowder

Programmer
Mar 20, 2002
224
0
0
Suppose I have 3 text boxes and one button on a page-

Text1
Text2
ButtonCalculate
TextResult


How can I get TextResult to display the value of (Text1 * Text2) when ButtonCalculate is Clicked?

Tom
 
Note - you have to set the ids in the HTML. VBScript and Javascript don't seem to pick up names.
Code:
<html>
<head>
<title>New Page 1</title>
<script language="vbscript">
sub Calc
   dim t1val, t2val, t3val
   t1val = cint (Text1.value)
   t2val = cint (Text2.value)
   t3val = T1val * t2val
   Text3.value = cstr (t3val)
end sub
</script>
</head>

<body>

  <p><input type="text" id="Text1" name="T1" size="20"></p>
  <p><input type="text" id="Text2" name="T2" size="20"></p>
  <p><input type="button" value="Button" name="B3" onclick="Calc"></p>
  <p><input type="text" id="Text3" name="T3" size="20">
</body>

</html>
 
Sweet! Thank you very much. Perfect :)

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top