gmonkey42: cartoon Sephiroth (Default)
gmonkey42 ([personal profile] gmonkey42) wrote2005-06-28 09:36 pm

um...

Why isn't this working? All I want to do is have an expanding menu and it's straightforward enough but it keeps saying "Object doesn't support this property or method" when I try to use getElementByID. But I have IE6 and I know it works with the DOM because the same thing works for me on other pages, just not mine.

I got just about the simplest example I could find and it still doesn't work. What's wrong with it?

<html>
<head>
<script language="JavaScript" type="text/javascript">
function ChangeTitle(){
var newtitle = document.form1.newtitle.value;
var changeme = document.getElementByID("head1");
changeme.firstChild.nodeValue = newtitle;
}
</script>
</head>
<body>
<h1 id="head1">Dynamic Heading<
<br>
<form name="form1">
<input type="text" name="newtitle">
<input type="button" value="Change!" onClick="ChangeTitle();">
</form>
</body>
</html>

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting