document.getElementByID "IS NOT A FUNCTION" error.

VERIFIED INVALID

Status

()

Core
DOM: CSS Object Model
--
major
VERIFIED INVALID
15 years ago
15 years ago

People

(Reporter: Steve Hobbie, Assigned: jst)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
   #container1 { position: absolute; top: 2in; left: 2in; width: 2in; }
   #container2 { position: absolute; top: 2in; left: 2in; width: 2in;
        visibility: hidden;}
-->
</STYLE>

<script language="javascript">

function flip(x, y) {
   alert('hiding:' +x);
   document.getElementByID(x).style.visibility ="HIDE";
   alert('showing:' +y);
   document.getElementByID(y).style.visibility ="SHOW";
   return;
}

</SCRIPT>

</HEAD>
<BODY>
<P>Choose a suspect:</P>
<DIV id="container1">
   <IMG alt="Al Capone" 
        width="100" height="100" 
        src="suspect1.jpg">
   <P>Name: Al Capone</P>
   <P>Residence: Chicago</P>
</DIV>

<DIV id="container2">
   <IMG alt="Lucky Luciano" 
        width="100" height="100" 
        src="suspect2.jpg">
   <P>Name: Lucky Luciano</P>
   <P>Residence: New York</P>
</DIV>

<FORM method="post">
   <P>
   <INPUT name="Capone" type="button" 
          value="Capone" 
          onclick='flip("container2", "container1");'>
   <INPUT name="Luciano" type="button" 
          value="Luciano" 
          onclick='flip("container1", "container2");'>
</FORM>
</BODY>
</HTML>

Comment 1

15 years ago
s/getElementByID/getElementById/
Javascript is case-sensitive.
s/HIDE/hidden/
s/SHOW/visible/

marking invalid - this is not a Mozilla bug
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

15 years ago
I stand corrected.  Much thanks to Andrew Schultz for pointing out my typo.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.