why does this not work in firefox?

D

darius

I have popup tooltip aka bubble hint implemented as below (for
simplicity, I've removed code to position the popup.)

<script>

// pop up 'pop' next to object 'obj'
function popup( obj, pop) {
pop.style.display="block";
//
//
}

function unpop( pop ) {
pop.style.display = "none";
}

</script>

<style>
..popupwin {
display: none;
}
</style>


<DIV name="popupA" ID="popupA" class="popupwin">
<b>some helpful text</b>
</DIV>

<span onmouseover="popup(this,popupA)" onmouseout="unpop(popupA)" > some
text
</span>


Works in IE6 and Opera 9. In FF 1.5, page loads w/o error, but when I
mouse over, I get "popupA not defined".

I substituted popupA with document.getElementByID('popupA') in the line
above and it gave me "document.getElementByID not a function". Huh?

any idea appreciated
 
R

RobG

I have popup tooltip aka bubble hint implemented as below (for
simplicity, I've removed code to position the popup.)
[...]
<DIV name="popupA" ID="popupA" class="popupwin">
<b>some helpful text</b>
</DIV>

<span onmouseover="popup(this,popupA)" onmouseout="unpop(popupA)" > some
text
</span>

Works in IE6 and Opera 9. In FF 1.5, page loads w/o error, but when I
mouse over, I get "popupA not defined".

The FAQ has you answer:

I substituted popupA with document.getElementByID('popupA') in the line
above and it gave me "document.getElementByID not a function". Huh?

Because it isn't. :) Use "document.getElementById" with a lower
case "d".
 
V

VK

<DIV name="popupA" ID="popupA" class="popupwin">

DIV doesn't have name attribute - unless you are using your own custom
DTD with XHTML. Otherwise leave ID only.
Works in IE6 and Opera 9. In FF 1.5, page loads w/o error, but when I
mouse over, I get "popupA not defined".

Automatical creation of global var for elements with ID was Microsoft
"invention". Some other browsers later mimiced it as well in order to
better survive, but Firefox mimics this behavior only in BackCompat
(aka Quirk) mode - roughtly when no doctype declaration is presented.
So "popupA not defined" means that you are using proper DOCTYPE on
your page in order to put browsers into CSS1Compat mode - good boy you
are.
:)
I substituted popupA with document.getElementByID('popupA') in the line
above and it gave me "document.getElementByID not a function". Huh?

Try your luck with getElementById ;-)
JavaScript is case-sensitive, so proper DOM methods spelling is a
must.
 
T

the DtTvB

Use getElementById()!

onmouseover="popup(this,document.getElementById('popupA'))"
onmouseout="unpop(document.getElementById('popupA'))"

If it looks too long, you can make a variable that is the reference to
the element.

var myPopupA = document.getElementById('popupA');

Then you can call popup(this,myPopupA)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top