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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

easiest script not working, help

Status
Not open for further replies.

Joshshift

Programmer
May 17, 2004
3
0
0
US
<html>

<head>
<script language="vbscript">
sub calc_onclick

frm.result.value = (frm.xxx.value) + (frm.yyy.value)

end sub
</script>
</head>
<body

<form method="post" action="" name=frm>
<input type = "text" name = "xxx">
<input type = "text" name = "yyy"><br>
<input type = "text" name = "result">
<input type="button" name="calc" value="calculate">


</form>
</body>
</html>



this is not working for some reason
 
What is not working? Is there an error? Does it do nothing at all? Is the debugger pointing out a problem line?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
try it out, put it in a browser, it just says error. my company is too cheap to buy me any type of debugging software, its all notepad for me.
 
It works for me when I add ">" to the <body> tag (missing in your code above.
Is that missing in your original code? Also, testing in IE, you can double-click an error-information symbol in status bar to get more info.
 
Plus, if you have MS Office installed, you should have or be able to install MS Script Editor which allow you some debugging.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
<html>

<head>
<script language="vbscript">
sub calc()

document.getElementById("result").value = (document.getElementById("xxx").value) + (document.getElementById("yyy").value)

end sub
</script>
</head>
<body

<form method="post" action="" id="frm">
<input type = "text" name = "xxx" value="">
<input type = "text" name = "yyy" value="">
<input type = "text" name = "result" value="">
<input type="button" name="calc" value="calculate" onclick="calc()">


</form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top