Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Banned
    Join Date
    Jan 2004
    Location
    Minneapolis, MN
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    document.getElementByID is not a function???

    that's what FireFox's JS console is telling me when i try to run this simple script:

    Code:
    <!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>

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    getElementById, not getElementByID. Tis case-sensitive.

  • #3
    Banned
    Join Date
    Jan 2004
    Location
    Minneapolis, MN
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ah, yes, i thought i tried that.. must be sloppy. thanks!

  • #4
    x^2
    x^2 is offline
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow...thanks for the tip.... I was struggling with this same problem for a couple hours before deciding to Google for it. Thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •