?I’m learning Javascript. Does anyone know why this code returns an error message ‘form’ is undefined. But the button works fine. What’s the difference between using a button or an <a href> link? I googled this and could not produce answers.
[CODE]<html>
<head>
<title>memory test</title>
<script language = “javascript”>
function MsgBox(greeting) {
alert(greeting);
}
</script>
</head>
<body>
this is the form.
<form>
<input name=”text1″ type=”text” />
<input type=”button” value=”show text” onClick=”MsgBox(form.text1.value)” />
<br />
<a href=”javascript:MsgBox(form.text1.value)”>submit</a>
</form>
</body>
</html>
Thank you.
-ac