Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NetScape and event handling

Status
Not open for further replies.

GIGN

Programmer
Oct 6, 2000
1,082
NZ
Hi, I am trying to make my site Netscape safe, but am having problems with events.

I have gone thru the processes of developing cross browser DOMS, but I find that sometimes when I try to use onMouseOver, or onClick, nothing happens in NN, even though it always works fine for IE. (I have tried using onClick inside <td>, perhaps not allowed in NN?)

The thing is I know my code works, because it works when I attach it to, say a link, but if I try to do this:
( where I have already constructed my cross browser object)

<script>
function showElement(DOMOBJECT){
javascript:DOMOBJECT.hide();
}

</script>
Nothing happens in NN? This is VERY infuriating. I have even tried direct DOM access, and just writing two parts for the function, one for each browser, but to no avail.

Can you tell me if Navigator interprets these event handlers differently or am I barking up the wrong tree!

Thanks, Ben [sig][/sig]
 
Unfortunately, Netscape 4.X suffers from much more limited availability of HTML elements for scripting. In IE 4.X, you can trap, and handle events from ANY (mostly) HTML element in the page, such as a <TR>. But in Netscape 4.x, the only areas where &quot;onclick&quot; works, for example, are form elements, such as buttons, and HREF's. Thus the workaround is, say you want onlick to work on an image... you need to make the image a hyperlink to nothing using the hash symbol.(<A HREF=&quot;#&quot; onclick=&quot;action()&quot;><IMG src=&quot;etc....)

You get the picture, and its not a very pretty one, unfortunately. It's going to look a lot better when Netscape 6 is more widely used, because, as IE, NN6+ will expose EVERY HTML element to scripting. For now, you need to create some serious workarounds. DHTML/Javascript master Dan Steinman has done a lot of your work for you, though. (
Also see and
Have fun :) [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top