PDA

View Full Version : Script Help: NetScape Compatibility.


MattyUK
12-08-2002, 03:23 PM
Hi

I have a page I am trying to make Netscape friendly.

http://www.edanblack.co.uk/test.htm

(contact and services links are experiments aka work in progress)

If uses the following script to set the display attribute on named and ID'd DIV tags.

function menudisplay(menushow)
{
document.getElementById('contact').style.display='none';
document.getElementById('services').style.display='none';
document.getElementById('freeservices').style.display='none';
document.getElementById('ebis').style.display='none';
document.getElementById('aboutus').style.display='none';
document.getElementById('careers').style.display='none';
document.getElementById('sitemap').style.display='none';
if (menushow!='none')
{
var ms="document.getElementById('"+menushow+"').style.display='inline'";
eval(ms);
}
}

Only problem is that it doesn't work on Netscape 7. However it is fine on Opera 6.04 and IE6.0. Any ideas why?

There are other problems on Opera (like the horizontal menu links not being clickable), but that is another issue.

I'd really appreciate any feedback. Many thanks in advance.

MattyUK

Postscript: Errm just noticed that Netscape doesn't really load/like the CSS file at all. So the site looks worse than it will be.

http://www.edanblack.co.uk/test.htm
http://www.edanblack.co.uk/cssp.htm

I'll look into the CSS thing with Netscrape later on.

Vladdy
12-08-2002, 03:45 PM
why eval???
straight-forward:

document.getElementById(menushow).style.display='inline';

should do just fine

MattyUK
12-08-2002, 05:27 PM
Thanks.
OK thats now done. Not sure how I let eval creep in there. Must have been legacy from before I adapted the function.

NetScape still doesn't show the menus. Does it understand the CSS display attribute with values or none and inline?

Any ideas anyone? This function simply fails without error suggesting it may be the browser/html code, but I need to be certain.

MattyUK
12-08-2002, 05:35 PM
Scrub that a quick empty of hte cache and Netscape scripts as desired. Thanks VLaddy.

Just got to work out the CSS problem now.

Any ideas? Any forums like this one for crosss browser coding you can put me onto?