I have a problem and am wondering if someone else knows the cure. The following code works fine in IE, but it chokes and dies in Netscape 7.2 when I try to use the value from a form field. Instead of an object, Netscape returns a null. Anyone have any ideas? Here is a link to the test page:
<html>
<head>
<script language = "javascript">
function testing()
{
alert("in testing()");
var thefield = document.getElementById("myfield");
alert("thefield = "+thefield);
abc = thefield.value;
alert("abc="+abc);
}
</script>
</head>
<body onLoad="testing()">
<form name="myform">
<p><input type="text" name="myfield" size="20"></p>
<p><input type="button" value="Test It" name="B1" onClick="testing()"></p>
</form>
</body>
</html>
<html>
<head>
<script language = "javascript">
function testing()
{
alert("in testing()");
var thefield = document.getElementById("myfield");
alert("thefield = "+thefield);
abc = thefield.value;
alert("abc="+abc);
}
</script>
</head>
<body onLoad="testing()">
<form name="myform">
<p><input type="text" name="myfield" size="20"></p>
<p><input type="button" value="Test It" name="B1" onClick="testing()"></p>
</form>
</body>
</html>