- From: nimblehost <jhead@hawaii.edu>
- Date: Fri, 18 Jul 2008 08:00:47 -0700 (PDT)
- To: www-dom@w3.org
I've found no references online that address this particular challenge, so I hope the DOM experts here can point out the mistakes in my code. The original html I am trying to replace looks like this: <link rel="stylesheet" type="text/css" media="screen" href="rw_common/themes/nhmobile/css/screenwidth/variable.css" /> I'd like to change the media attribute to "all" when the page loads so that it looks like this instead: <link rel="stylesheet" type="text/css" media="all" href="rw_common/themes/nhmobile/css/screenwidth/variable.css" /> The code I've come up with is as follows: <script type="text/javascript"> var mediaType = document.getElementsByTagName("link"); for(x=0; x<mediaType.length; x++) { mediaType.item(x).setAttribute("media", "all"); } </script> Using firebug to check the current tree of nodes shows that the media attribute remains unchanged. I'm at a loss at how to fix this problem. Any and all help is greatly appreciated. Best regards, Jonathan -- View this message in context: http://www.nabble.com/Using-DOM-to-replace-media-attribute-in-the-link-tag-on-page-load-tp18531235p18531235.html Sent from the w3.org - www-dom mailing list archive at Nabble.com.
Received on Monday, 21 July 2008 08:02:57 UTC