CSS – JavaScript Chooses Which One

[Total: 0    Average: 0/5]

This shows a method to have javascript choose which CSS to use.

Head Code:

<script language="JavaScript"><!--
 if (navigator.userAgent.indexOf("MSIE 4") != -1)
   {
 document.write("<link rel=stylesheet href="ie.css" type="text/css">");
 document.write("<style>");
 document.write("<<!-->");
 document.write("<//-->>");
 document.write("</style>");
   }
 else
   {
 if (navigator.appName == "Netscape")
   {
 document.write("<link rel=stylesheet href="ns.css" type="text/css">");
   }
 else
   {
 document.write("<link rel=stylesheet href="ie.css" type="text/css">");
 }
   }
 //-->
 </script>

Body Code:


Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *