View Full Version : document.getElementByID is not a function???

03-17-2004, 12:45 AM
that's what FireFox's JS console is telling me when i try to run this simple script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function change(e) {
document.getElementByID(e).style.backgroundColor = "#440503";
function changeBack(e) {
document.getElementByID(e).style.backgroundColor = "#000000";
<style type="text/css">
#box {
height: 500px;
width: 500px;
margin: 25px;
border: 3px double #FFF;
background: #000;

<div id="box" onmouseover="change('box')" onmouseout="changeBack('box')">&nbsp;</div>

03-17-2004, 12:47 AM
getElementById, not getElementByID. Tis case-sensitive.

03-17-2004, 12:50 AM
ah, yes, i thought i tried that.. must be sloppy. thanks!

11-12-2007, 11:59 PM
Wow...thanks for the tip.... I was struggling with this same problem for a couple hours before deciding to Google for it. Thanks!