I am linking to multiple style sheets through JavaScript, and it only is working on my home page, which is in the same file as everything else.
[B]My JS Stylesheets link
[code]
document.write(“<link rel=’stylesheet’ type=’text/css’ href=’style1.css’ title=’greenstyle’>”)
document.write(“<link rel=’alternate stylesheet’ type=’text/css’ href=’style2.css’ title=’redstyle’>”)
document.write(“<link rel=’alternate stylesheet’ type=’text/css’ href=’style3.css’ title=’tealstyle’>”)
document.write(“<link rel=’alternate stylesheet’ type=’text/css’ href=’style4.css’ title=’purpstyle’>”)
document.write(“<link rel=’alternate stylesheet’ type=’text/css’ href=’style5.css’ title=’blackstyle’>”)
document.write(“<link rel=’alternate stylesheet’ type=’text/css’ href=’style6.css’ title=’yellowstyle’>”)
document.write(“<link rel=’alternate stylesheet’ type=’text/css’ href=’style2-1.css’ title=’blackpinkstyle’>”)
document.write(“<link rel=’alternate stylesheet’ type=’text/css’ href=’style2-2.css’ title=’yellowgreenstyle’>”)
[B]My link to the code above
[code]
<script type=”text/javascript” src=”/stylesheets.js”></script>
[B]My Code to display the text links
[code]
document.write(“<ul>”)
document.write(“<li><h3>Select A Color Scheme</h3></li>”)
document.write(“<li><li><a class=”nav” href=”#” onclick=”setActiveStyleSheet(‘greenstyle’); return false;”>Green</a></li>”)
document.write(“<li><li><a class=”nav” href=”#” onclick=”setActiveStyleSheet(‘redstyle’); return false;”>Red</a></li>”)
document.write(“<li><li><a class=”nav” href=”#” onclick=”setActiveStyleSheet(‘tealstyle’); return false;”>Teal</a></li>”)
document.write(“<li><li><a class=”nav” href=”#” onclick=”setActiveStyleSheet(‘purpstyle’); return false;”>Purple</a></li>”)
document.write(“<li><li><a class=”nav” href=”#” onclick=”setActiveStyleSheet(‘blackstyle’); return false;”>Black</a></li>”)
document.write(“<li><h3>Multiple Colors</h3></li>”)
document.write(“<li><li><a class=”nav” href=”#” onclick=”setActiveStyleSheet(‘blackpinkstyle’); return false;”>Black/Pink</a></li>”)
document.write(“<li><li><a class=”nav” href=”#” onclick=”setActiveStyleSheet(‘yellowgreenstyle’); return false;”>Yellow/Green</a></li>”)
document.write(“</ul>”)
[B]My problem:
I use the same script on my home page, only instead of src=”/stylesheets.js”, I use src=”stylesheets.js” I know that most of the code works, because the link is linking to the stylesheets, but it isn’t applying that style to that page.
[B]Try It:
[url]http://webtoolz.t35.com/