[Javascript] Name attribute for link

Roger Roelofs rer at datacompusa.com
Sat Nov 29 08:02:04 CST 2003


Nazir,

Google is your friend.  I typed "css style switcher js" and got dozens 
of scripts that do what you want.  Here's number one, also arguably the 
most famous one.  <http://www.alistapart.com/articles/alternate/>

Your stylesheet is not inside a form, so you don't want to say 
document.forms... You want to either give your link tag an id and use 
document.getElementbyId, or use the script from a list apart and scan 
all the link tags for the title you're looking for (that is the better 
solution).


On Nov 29, 2003, at 4:43 AM, Nazir Wasim Ahmed wrote:

> Hi All,
>  
> How can i change the stylesheet name(href) of my page dynamically?
> I need to change the stylesheet name when a combo is selected..
>  
> I tried giving something like
> <link href="" name="mylink">
>  
> and then on body load i tried changing the href to another location
> document.forms[0].mylink.href="\someotherlocation";
>
Roger,

Roger Roelofs
Datacomp Appraisal Services




More information about the Javascript mailing list