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/IE Incompatibilities with Javascript 1

Status
Not open for further replies.

Desio

Programmer
Jun 12, 2000
3
US
My Javascript-enabled interface located at <A HREF=" TARGET="_new"> works splendid in IE but fails to function at all in Netscape.&nbsp;&nbsp;Only the onLoad event will trigger in my images.&nbsp;&nbsp;The onMouseOver and onClick events do not trigger.&nbsp;&nbsp;I am confused as to what is wrong.
 
When I imported your code into my script editor and ran a syntax & browser compatibility check, I got the following.<br><br>No syntax errors.&nbsp;&nbsp;That's good!<br><br>HTML not compatible with NS 4.0 and lower.&nbsp;&nbsp;Probably not a great concern.<br><br>But the problem MIGHT be in your choice of variable names and method names.&nbsp;&nbsp;For example, index, which you use as an array name, appears color coded as a 'keyword' within my editor, even though it doesn't show up as a keyword for javascript in any of my sources.&nbsp;&nbsp;It shouldn't be a problem, but it appears to raise a huge flag.&nbsp;&nbsp;I would avoid using that as an array name.<br><br>Also, your use of 'files' and 'src' as property names (ie: index.files, document.images[14].src, etc.) seems to raise a flag.&nbsp;&nbsp;The message I got was that it was supported in Jscript 3.0 and higher, implying that it is not supported in JavaScript. I find that a confusing message.&nbsp;&nbsp;I do know that 'src' as a property name does cause problems.&nbsp;&nbsp;Not sure why.<br><br>P.S.&nbsp;&nbsp;I like the looks of your page.<br><br><A HREF=" TARGET="_new">
 
By the way, I forgot to mention, you use alot of apostrophies in your comments when using contractions.&nbsp;&nbsp;I think they might be causing a problem also.&nbsp;&nbsp;That shouldn't be the case, but again, my program reads that as valid script syntax and interprets the code as a comment.&nbsp;&nbsp;Perhaps Netscape is doing the same thing.&nbsp;&nbsp;Try removing double and single quotes as well.&nbsp;&nbsp;I could be wrong about that.&nbsp;&nbsp;It might just be a bug in my program as well.
 
This is the best (and probably the only worthwhile) windows mockup I have seen.<br><br>The problem you are haveing is due to the fact that Netscape does not support the range of event handling found in IE, there is no onClick event for images for example. <br><br>The solution is to enclose each image within a link, the href attribute of the link points to a function for your onClick event and Netscape does support full event handling for the the &lt;A&gt; tag (onMouseOver etc.).<br><br>At least both browsers allow you to use the Images collection so the same set of event handlers will work in each.
 
I have just experimented repeatedly with Navigator.&nbsp;&nbsp;The browser will only use the onMouseOver and onClick events an &lt;A&gt; tag if the HREF=&quot;&quot; stipulent is included.<br><br>Unfortunately, I can't do this due to the up and down arrows and also to the fact that the entire folder directory is navigated on mainpage.htm without ever moving to another document.&nbsp;&nbsp;The images point to different links at different times -- I use the onClick event to send the mere fact that the image has been clicked to the main subroutines which *then* ascertain exactly which icon was *really* clicked.&nbsp;&nbsp;They then perform the appropriate action.<br><br>Is there any way to give an image an onClick event without using the HREF= stipulent of the &lt;A&gt; tag?&nbsp;&nbsp;I can't have the images *actually* being links to anything.<br><br>And why in the world doesn't Netscape give onClick and onMouseOver functionality to an image?
 
I feel your pain, Desio.&nbsp;&nbsp;Frankly, programming for Netscape just sucks.&nbsp;&nbsp;I've encountered the exact problem you're having,&nbsp;&nbsp;but the best I've been able to do is this:<br>&lt;A HREF = &quot;#&quot; onClick = &quot;MyClickEvent()&quot;&gt;&lt;IMG SRC = &quot;myimage.jpg&quot;&gt;&lt;/a&gt; <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Genius!<br><br>Thanks guys.&nbsp;&nbsp;Version 1.1 (still content-less) is uploaded, fully Netscape compatible.&nbsp;&nbsp;The &lt;A HREF=&quot;#&quot;&gt; cured it.&nbsp;&nbsp;Content should be up by Friday.&nbsp;&nbsp;I think I might try to enter it in a Javascript competition as soon as I have content on the page.
 
Good luck in the competition. Let us know how it goes. <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Hey Nick... your breaking out some negative comments for Nutscrap... cool.<br><br>But don't be too hard on them. Back in the day (hehe), during versions 1 and 2 of IE the Netscape browser was the only one that worked at all. Those early versions of IE were funny to watch, they could barely get loaded into memory before crashing. ;o)<br><br>-pete
 
Yes, there was a time when Netscape was a superior browser, but those days are long gone.&nbsp;&nbsp;It's no surprise to me that Microsoft won the browser war. <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top