[thelist] Javascript style switching help

Tony Grimes info at scribenewmedia.com
Mon Jan 3 09:02:37 CST 2005


I've written a script that should switch a style sheet, but it only works in
Safari. IE and Netscape aren't switching. Can anyone help? Here's the
relevant code:

function activatePrintCSS() {
    var i, a;
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
        if(a.getAttribute("rel") == "print css" && a.getAttribute("title")
== "print") {
            a.disabled = false;
            document.getElementById("print-toggle").style.display = "none";
            document.getElementById("print-toggle-return").style.display =
"inline";
            showAllDescriptions();
            showHideDescriptionToggle("hide");
        }
    }
}

In IE and Netscape everything is being properly executed except this
expression:

    a.disabled = false;

Here is the test site if you want to see the whole thing:

http://www.tonygrimes.com/rets/

When you click on ³Print Friendly Version², it should switch stylesheets to
provide a preview for the user before they print the page.

If anyone can help me out I¹d really appreciate it.

Tony




More information about the thelist mailing list