By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,176 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

Why wont JS script trigger on mouse-over in NS and Mozilla

P: n/a
I have a project that uses mouse-over JS script to show and hide layers that
works well in MSIE 6.0 and Opera.

But, it does not work in NS nor Mozilla.

It is here: http://www.wgtn.net/Business/category_layer.htm

A mouse-over of any of the letters in that left vertical panel of letters
shoud trigger a JS script that shows the appropriate panel on the right.

The code pases HTML and CSS validation.

What could be inhibiting the mouse-over trigger in NS and Mozilla?
Jul 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
news frontiernet.net wrote:
I have a project that uses mouse-over JS script to show and hide layers
that works well in MSIE 6.0 and Opera.

But, it does not work in NS nor Mozilla.

It is here: http://www.wgtn.net/Business/category_layer.htm


It is being triggered. You test for document.all, which is a non-standard
DOM supported by IE and Opera, then you test for document.layers, which is
a non-standard DOM supported by Netscape 4.x. Then you give up.

Try using the standard:
http://w3.org/TR/1998/REC-DOM-Level-1-19981001/

(Note that you'll want to use the ECMA Script Language Binding to DOM 1 for
this)

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2

P: n/a
"news frontiernet.net" <rf******@rconnect.com> wrote in message
news:J0*****************@news02.roc.ny...
I have a project that uses mouse-over JS script to show and hide layers that works well in MSIE 6.0 and Opera.

But, it does not work in NS nor Mozilla.

It is here: http://www.wgtn.net/Business/category_layer.htm

A mouse-over of any of the letters in that left vertical panel of letters
shoud trigger a JS script that shows the appropriate panel on the right.

The code pases HTML and CSS validation.

What could be inhibiting the mouse-over trigger in NS and Mozilla?


Skip this:

if (document.layers && document.layers[object]) {
document.layers[object].visibility = 'visible';
}
else if (document.all) {
document.all[object].style.visibility = 'visible';
}

and replace it with this:
if( document.getElementById )
document.getElementById(object).style.visibility = 'visible';
else
alert("Please download a decent Standard compliant browser!");
What you do is some half-hearted IE/Opera and NS4 testing (Both
non-standard).
document.getElementById(...) is supported by all the browsers worth worrying
about. (NS 4.x is NOT one of them!)

--
Dag
5826'15.9" N 00846'45.5" E
Jul 23 '05 #3

P: n/a
Thanks!

That does make the trigger work for NS too.

However there seems to still be an oddity. While the trigger works going
DOWN the panel of letters, settin each corresponding layer to visible and
displaying the correct material for that letter. It doesnt work in NS going
back UP the panel of letters. It works in MSIE.

Are there other browser specific errors with this JS script that are causing
this?

"Dag Sunde" <ds@orion.no-way> wrote in message
news:Z6*****************@juliett.dax.net...
"news frontiernet.net" <rf******@rconnect.com> wrote in message
news:J0*****************@news02.roc.ny...
I have a project that uses mouse-over JS script to show and hide layers that
works well in MSIE 6.0 and Opera.

But, it does not work in NS nor Mozilla.

It is here: http://www.wgtn.net/Business/category_layer.htm

A mouse-over of any of the letters in that left vertical panel of letters shoud trigger a JS script that shows the appropriate panel on the right.

The code pases HTML and CSS validation.

What could be inhibiting the mouse-over trigger in NS and Mozilla?


Skip this:

if (document.layers && document.layers[object]) {
document.layers[object].visibility = 'visible';
}
else if (document.all) {
document.all[object].style.visibility = 'visible';
}

and replace it with this:
if( document.getElementById )
document.getElementById(object).style.visibility = 'visible';
else
alert("Please download a decent Standard compliant browser!");
What you do is some half-hearted IE/Opera and NS4 testing (Both
non-standard).
document.getElementById(...) is supported by all the browsers worth

worrying about. (NS 4.x is NOT one of them!)

--
Dag
5826'15.9" N 00846'45.5" E

Jul 23 '05 #4

P: n/a
Lee
news frontiernet.net said:

Thanks!

That does make the trigger work for NS too.

However there seems to still be an oddity. While the trigger works going
DOWN the panel of letters, settin each corresponding layer to visible and
displaying the correct material for that letter. It doesnt work in NS going
back UP the panel of letters. It works in MSIE.

Are there other browser specific errors with this JS script that are causing
this?


You need to fix your "hide()" function, too.
Currently, it's never hiding any layer, so once a layer has been
made visible, there's no way to see any "lower" layer.

Jul 23 '05 #5

P: n/a
Yes !!!

That works!

I am a cut-n-paste js script user. That script has been around a while.

Thank you!

"Lee" <RE**************@cox.net> wrote in message
news:cj*********@drn.newsguy.com...
news frontiernet.net said:

Thanks!

That does make the trigger work for NS too.

However there seems to still be an oddity. While the trigger works going
DOWN the panel of letters, settin each corresponding layer to visible and
displaying the correct material for that letter. It doesnt work in NS goingback UP the panel of letters. It works in MSIE.

Are there other browser specific errors with this JS script that are causingthis?


You need to fix your "hide()" function, too.
Currently, it's never hiding any layer, so once a layer has been
made visible, there's no way to see any "lower" layer.

Jul 23 '05 #6

P: n/a
"news frontiernet.net" <rf******@rconnect.com> writes:
I am a cut-n-paste js script user. That script has been around a while.


And it shows!
That script was probably created four or five years ago, back when the only
browsers being recognized was IE 4 and Netscape 4. Luckily, we are long
past that, but some scripts fail to retire gracefully :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #7

P: n/a
David Dorward wrote:
news frontiernet.net wrote:
I have a project that uses mouse-over JS script to show and hide layers
that works well in MSIE 6.0 and Opera.

But, it does not work in NS nor Mozilla.
[...]
[...]
Try using the standard:
http://w3.org/TR/1998/REC-DOM-Level-1-19981001/


You are a bit behind time.
(Note that you'll want to use the ECMA Script Language Binding to DOM 1
for this)


No, he does not want that, for there is no _ECMAScript_ Language Binding
for (Cascading) Style Sheets in DOM Level 1, in contrast to DOM Level 2:

<http://www.w3.org/TR/DOM-Level-2/>
<http://www.w3.org/TR/DOM-Level-2-HTML/>
<http://www.w3.org/TR/DOM-Level-2-Style/>
PointedEars
--
Can't you hear Moe saying this "That's real good... if you like crap!"
Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.