PDA

View Full Version : combine scripts



walshy
12-15-2006, 01:52 AM
G'day
i was wondering if it is possible to combine these two scripts.
Style Sheet Switcher
http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm
with the
Browser redirect Script
http://www.dynamicdrive.com/dynamicindex9/bredirect.htm
So that i would end up with a script that would redirect the user to a different CSS doc depending on what browser they are using.
e.g.
Firefox user is directed to the Firefox CSS doc and vis a versa for IE users

any help would be appreciated

regards
Walshy

jscheuer1
12-15-2006, 05:06 AM
There is a better way, especially when you consider that css style is not javascript and should work even if javascript is disabled. You should set up your styles for FF in one file and link to it first in the head of your page, ex:


<link rel="stylesheet" href="ff_styles.css" type="text/css">

These ff_styles.css rules will be used for all browsers. Then make up your styles for IE, overriding any of the styles in ff_styles.css if and where need be and including any additional styles that are for IE only. Link them next in the head like so:


<!--[if IE]>
<link rel="stylesheet" href="ie_styles.css" type="text/css">
<![endif]-->