[thelist] Variables and the DOM

The Optimizer chrism at puffofsmoke.net
Wed Oct 10 07:18:27 CDT 2001


[..]
> This works. objDOM now has become a reference to
> document.forms[0] so that
> you can do everything with it you can do with document.forms[0]

This is what I thought. However, when I click on the link in the following
HTML page, I get the error "'objForm.elements' is not an object":

<html>
<head>
<title>Test</title>
<script>
var objForm = document.forms[0];
var intValue;
intValue = 0;
function test() {
	objForm.elements[0].value = intValue;
	intValue++;
}
</script>
</head>
<body>
<a href="javascript:test()">Click</a>
<form>
<input type="text">
</form>
</body>
</html>

Puzzled...

Chris Marsh





More information about the thelist mailing list