|
Hello,
Im trying to learn how to integrate javascript with forms so i wrote this script to display on screen in an alert box which number you click just as a test but it doesnt work and it doesnt generate an error in ie6 so im a bit stuck as to why it doesnt work.
I'd be very grateful if someone could share a bit of their wisdom with me.
Thanks
BEGIN CODE:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Form Button Test</title>
<script type="text/javascript">
function calculate(whichbox){
if (whichbox = 1);
alert("value is 1");
else (whichbox = 2);
alert("value is 2");
else (whichbox = 3);
alert("value is 3");
else (whichbox > 3);
alert("error value higher than 3");
else (whichbox < 3);
alert("error value less than 3");
}
</script>
</head>
<body>
<form>
<input name="one" type="submit" id="1" value="1" onClick="calculate(1)">
<input name="two" type="submit" id="2" value="2" onClick="calculate(2)">
<input name="three" type="submit" id="3" value="3" onClick="calculate(3)">
</form>
</body>
</html>
|