[ic] set variable using Javascript???

Tim Watts interchange-users@lists.akopia.com
Thu Jul 5 08:17:01 2001


we use java to id the browser and load a different set of css for Mac
netscape, it seems to be the biggest problem for us. Rather than bouncing to
a different page, we just load a different css. Here's the code, it's at the
top of each region page, so it doesn't matter what page they hit first.  You
can adapt for your use if you'd like:


<SCRIPT Language="JavaScript">
check_OS= navigator.userAgent.indexOf;
browser_type = navigator.appName;
if (browser_type == "Netscape" && (check_OS = "Mac")) {
document.write("<LINK Href='/styles/site_text_nsmac.css' Rel='styleSheet'
Type='text/css'>");
} 
else {
document.write("<LINK Href='/styles/site_text.css' Rel='styleSheet'
Type='text/css'>");
}
</SCRIPT> 


Watch the wrap from pasting into email...



on 7/3/01 3:20 PM, Scott Trunkhill at trunk@morris.com wrote:

> I am working on a site that has a dhtml menu. We have three versions
> of the navigation and when someone first comes to the site we
> redirect them to an index page which sets a menutype variable.
> 
> The problems is if someone come to the site directly to a page other
> than the index this variable never gets set. Detecting which browser
> they have is no problem but can I set a variable using javascript?
> 
> 
> 


Tim Watts
president
Romans1013.net
Internet Hosting