...

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



coder_seth
03-16-2004, 11:45 PM
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">
<head>
<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";
}
</script>
<style type="text/css">
#box {
height: 500px;
width: 500px;
margin: 25px;
border: 3px double #FFF;
background: #000;
}
</style>
</head>

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

jkd
03-16-2004, 11:47 PM
getElementById, not getElementByID. Tis case-sensitive.

coder_seth
03-16-2004, 11:50 PM
ah, yes, i thought i tried that.. must be sloppy. thanks!

x^2
11-12-2007, 10: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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum