FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Not working as planned on Firefox...

 


mwilson82
Here's a quick question that hopefully someone can give me some insight on without having to post all the code. Simply, here's the website: http://members.lycos.co.uk/mwsupra/ and if you could just look at the first page that comes up and load it in IE, then in Firefox. Same code, very different results for the navigation bar near the top. Instead of the code I'll just explain that the nav bar that is having problems is setup with html tables. The BGCOLOR tag doesn't work in this example in Firefox and the images do not show at all. Does anyone know what could cause a difference like this?
Traveller
Quite simply: IE implements some elements differently from Firefox, Opera, Safari, et al, and you need to find the code you are using that has differences, then put in conditional code to get around it. Here's a typical JavaScript example:
Code:
   var browsertype=navigator.appName;

   function loadthumbs(id,start) {
      for (var i=0; i<12; i++) {
         if (picfile[i+start]!="NIL") {
            document.images["thumbpic"+(i+1)].src="listings/" + id + "/thumbs/" + picfile[i+start];
            if (browsertype=="Microsoft Internet Explorer") {
               document.anchors("thumblink"+(i+1)).href="javascript:loadpic('" + id + "','" + picfile[i+start] + "');";
            } else {
               document.anchors["thumblink"+(i+1)].href="javascript:loadpic('" + id + "','" + picfile[i+start] + "');";
            }
...

Note that, for the "document.anchors" array, IE uses parentheses for the subscripts, but everyone else uses brackets, so it was necessary to put in special code to check for the browser type in order to use the right syntax.

Remember: the main reason some things work in IE, but not in other browsers is that IE allows certain sloppiness, people code TO that sloppiness, and better designers and programmers wind up having to to do special coding. Thus, IE should NEVER be used as the baseline for determining the quality and usability of a webpage.
mwilson82
Thanks for the response. Definitely gives me something to start with, since I've never really had this problem with browser compatibility before.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.