How to conditionally disable a javascript?

    Date: 09/15/06 (WebDesign)    Keywords: css, java

    So I'm working on a printer-friendly version of a bunch of pages, my ultimate goal being to just be able to do a style sheet switch on the same page and not create a duplicate "printer friendly" page.

    It's going well, except for one thing:
    I have the regular page using javascript to handle a tabbed function that switches content to show different information (similar to the "Features/Description/etc" tabs on this Target page.

    For the printer friendly version, I need to disable this script so all the information writes on the page at one time. I have the style set up so it looks good once the script is disabled, but I can't figure out how to disable it without creating a separate page.

    The script is linked in the head to a separate .js file and is activated by a line in the page's BODY:


    I tried wrapping it in a div and setting the css to "display: none;" in the print style sheet but (surprise, surprise) that only affects the display and doesn't stop the script from functioning.

    Is there some sort of javascript language I could add that would be the equivilant of:
    "If using print.css, disable this script"?

    I only know my way around javascript enough to do some semi-basic customizing of prewritten scripts. I don't know the language... I can just pick out parts I need.

    Can anyone figure out any good workarounds? (Other than having a separate printer-friendly page?)

    Source: http://community.livejournal.com/webdesign/1165332.html

« .htaccess || Looking for input »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home