Newbie: NN 7.2 issue

2

23s

function fadeInSay(tip, desc)
{
menubar_tip.innerHTML = tip;
menubar_description.innerHTML = desc;
menuTipReset(true);
}

The above function executes without error in Firefox 1.0 and IE 6.0, but in
NN 7.2:

Error: menubar_tip is not defined
Source File: clsBasePage_preload.js

Page source:

<html><head><title>somepage</title></head><body>
<script language=javascript src="clsBasePage_preload.js"></script>
<table><tr><td id="menubar_tip"></td></tr></table>
</body></html>

How would NN 7.2 like me to reference menubar_tip?
 
K

kaeli

[email protected] enlightened said:
<html><head><title>somepage</title></head><body>
<script language=javascript src="clsBasePage_preload.js"></script>
<table><tr><td id="menubar_tip"></td></tr></table>
</body></html>

How would NN 7.2 like me to reference menubar_tip?

Probably using more DOM-oriented syntax.

if (document.getElementByID)
{
document.getElementById("menubar_tip").innerHTML=tip;
}

That will work in all browsers that support document.getElementById,
including Firefox, Mozilla, IE6, Opera, and Netscape 6+ (possibly more).
Will do nothing in old browsers.

--
 
R

RobB

23s said:
function fadeInSay(tip, desc)
{
menubar_tip.innerHTML = tip;
menubar_description.innerHTML = desc;
menuTipReset(true);
}

The above function executes without error in Firefox 1.0...

(snip)

I'd like to see that.
 
R

RobG

RobB said:
(snip)

I'd like to see that.

Try:

<button onclick="
alert(steve.nodeName);
">Show steve</button>
<span id="steve">I'm the steve span</span>

It works in Firefox - but also generates a warning (for those
that care to look):

"Warning: Element referenced by ID/NAME in the global scope.
Use W3C standard document.getElementById() instead."
 
R

RobG

RobG wrote:
[...]
It works in Firefox - but also generates a warning (for those
that care to look):

"Warning: Element referenced by ID/NAME in the global scope.
Use W3C standard document.getElementById() instead."

Ooops, meant to qualify that - it works if no DOCTYPE specified,
or with HTML 4.0 Transitional but not with HTML 4.01 strict.
 
R

Robert

RobG said:
It works in Firefox - but also generates a warning (for those
that care to look):

"Warning: Element referenced by ID/NAME in the global scope.
Use W3C standard document.getElementById() instead."

I believe Firefox puts out this message the first time you do a
document.all reference. Firefox provides limited support for
Document.all but older gekco based browsers like netscape 7.1 do not.

Robert
 

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,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top