What did I do wrong this time?!

In my javascript book, I have an exercise where I’m supposed to create a document with a couple of elements each of which have id attributes, then retrieve those elements and make changes to them. So, here’s the code I tried to run…Firebug is telling me that “document.getElementbyID is not a function”. What’s wrong?


<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>

<p id=“para1”>This is paragraph 1 </p>
<p id=“para2”>This is paragraph 2 </p>

&lt;script type = "text/javascript" &gt;
	[COLOR="Red"]var e1 = document.getElementByID("para1");[/COLOR]
	var e2 = document.getElementByID("para2");
	e1.innerHTML = "New para1";
	e2.innerHTML = "New para2";



You have used the wrong syntax. It should be:




Thanks Allan. I made a similar mistake a few days ago with innerHTML! Hopefully now I’ll remember how particular javascript is re. upper/lower case.

I really appreciate you, and the others who continue to take the time to help me out --I would have already given up without this forum!