Wednesday September 18, 2002

Mozilla Fix from Porter. I received the following message from Porter just a few minutes ago:
Hey Matt,
Just a quick FYI: your latest style switcher worked fine for me in
WinMoz 1.2a. I get the full sunset style after clicking the link.
- Porter
I downloaded the latest Mozilla (1.2a) and whalla - now it works great. Quite a delimna now though - especially since I'm using similar code on a client's app I'm building write now. So I guess this validates that my code is correct and now I have to find a workaround for Mozilla 1.1.
Posted in Roller
at Sep 18 2002, 04:34:01 PM MDT
Add a Comment
Working with the DOM.
After working with the DOM trying to get my new theme switcher to work, I find that M$ has done a nice job of making it easier for me. IE on both Windows and Mac support document.styleSheets[0].imports and document.styleSheets[0].addImport(url). These have made it very easy for me to replace the @import statement in a <style> declaration. However, Mozilla is a different story. I have created a new switchTheme method that is as follows:
<script type="text/javascript">
<!--
function switchTheme(themeName) {
var docSheet = document.styleSheets[0];
var nextTheme = "/skins/" + themeName + "/styles/colors-n-fonts.css";
if (document.all) {
docSheet.removeRule[0];
docSheet.addImport(nextTheme);
} else {
docSheet.deleteRule(0);
docSheet.insertRule('@import url(' + nextTheme + ');',0);
}
var nextTitle = "/skins/" + themeName + "/images/title-rd.gif";
document.getElementById("title").src = nextTitle;
}
// -->
</script>
In Mozilla, this appears to work - as the mouseover colors on my links do change to use the 'sunset' theme. Unfortunately, that's all that changes. As usual, any suggestions are appreciated. Also, did you know IE/Mac supports document.all? I didn't think it did... until today!
Try this code in your browser by clicking here.
While developing this script, I received many tips and hints from this site.
Posted in The Web
at Sep 18 2002, 02:50:36 PM MDT
Add a Comment
Search This Site
Recent Entries
- My What's New in Spring 3.1 Presentation
- Twitter's Open Source Summit: Bootstrap 2.0 Edition
- Refreshing AppFuse's UI with Twitter Bootstrap
- 2011 - A Year in Review
- Upgrading AppFuse to Spring Security 3.1 and Spring 3.1
- What have I been working on at Taleo?
- Our Engaging Trip to Paris and Antwerp
- My HTML5 with Play Scala, CoffeeScript and Jade Presentation from Devoxx 2011
- Deploying Java and Play Framework Apps to the Cloud with James Ward
- PhoneGap for Hybrid App Development