Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 681

Please help with VB script

$
0
0
Hi,
I have been given an assignment which is to make a fraction calculator. I have started coding but can not get my numbers to add even though the code appears to be correct. Can someone please tell me where I have gone wrong? I have spent the last two hours trying to figure it out.

:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Fraction Calculator</title>
</head>
<body>
<center><h1>Fraction Calculator</h1></center>
<body bgcolor="olive" />
<center>
Fraction One Num:<input id="textTop" type="text" /> Fraction Two Num<input id="textTop2" type="text" /> EqualN:<input id="txtNum" type="text"/> </br>

Fraction One Den:<input id="textBot" type="text" /> Fraction Two Den<input id="textBot2" type="text" /> EqualD:<input id="txtDen" type="text" /> </br>

<input id="btn+" type="button" Value="Plus" /> <input id="btn-" type="button" value="-" /> <input id=btn/" type="button" value="/" /> <input id="btn*" type="button" value="*" /> <input id="btnSim" type="button" value="Simplify" />
</center>

</body>
</html>

<script language="vbscript">
Sub btn+_OnClick()
txtNum.value= Cint(textTop.value) *Cint(textBot2.value) +Cint(textTop2.value) *Cint(textBot.value)
txtDen.value= Cint(txtBot.value) * Cint(textBot2.value)
end sub
</script>

Viewing all articles
Browse latest Browse all 681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>