astralaaron Posted July 26, 2012 Share Posted July 26, 2012 Is there a way to change stylesheets with javascript that works on IE? changing the href by setting an ID to the <link rel="stylesheet"> only works in firefox, I also tried creating a new link element and appending it to the head of the document but it also works in firefox only.. Link to comment Share on other sites More sharing options...
eTianbun Posted July 26, 2012 Share Posted July 26, 2012 (edited) Use: document.getElementsByTagName('link')[0].href="newStyle.css" and dont forget to include the type attribute of the <link>. I.e: <link rel="stylesheet" type="text/css"> Edited July 26, 2012 by CodeName Link to comment Share on other sites More sharing options...
eTianbun Posted July 26, 2012 Share Posted July 26, 2012 (edited) Duplicate removed! Edited July 26, 2012 by CodeName Link to comment Share on other sites More sharing options...
astralaaron Posted July 26, 2012 Author Share Posted July 26, 2012 Thanks buddy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now