Forum Moderators: open
The link from my page to the script is not a problem.....the script doesn't seem to want to run externally for some reason though......It runs fine if i embed it in the page.
regards,
5th cup of java.
<script type="text/javascript" language="JavaScript">
document.write('<link type="text/css" rel="stylesheet" ');
if (screen.width <= 800 & navigator.appName=="Netscape" ){
document.writeln(' href="../../../../firefox800.css">'); }
else if (screen.width >= 1024 & navigator.appName=="Netscape" )
{document.writeln(' href="../../../../firefox1024.css">'); }
else if(screen.width <= 800 & navigator.appName=="Microsoft Internet Explorer" )
{document.writeln(' href="../../../../global.css">'); }
else (screen.width >= 1024 & navigator.appName=="Microsoft Internet Explorer" )
{document.writeln(' href="../../../../IE1024x768.css">'); }
</script>
1) Javascript boolean AND is && not & (that's binary AND)
2) The final else condition is missing an if
Assume you know that you don't use <script> tags inside external script files.
It's probably easier to do something like this:
var fileBaseName;
// ..code to choose from 'global', 'firefox800' etc..
Then :
document.writeln(
'<link type="text/css" rel="stylesheet" href="../../../../' + fileBaseName + '.css">'
);