Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Help turning on/off Javascript using a hyperlink

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #31711
    Eightyk
    Member

    I’m using a javascript that is pretty heavy on older computers and I would like to have an on/off text hyperlink on the site (default on)… I cant seem to find what I need using google, or I dont know what to search for to achieve this. Please help!

    #58956
    TT_Mark
    Member

    I don’t think you can turn JavaScript on/off in a webpage, otherwise this would already have been exploited to take away the choice of disabling it from the user

    #58933
    Eightyk
    Member

    I don’t want to turn all javascript off on the page. Just a single script.

    #58880
    noahgelman
    Participant

    I don’t think it’s possible. Once the browser has the script, it has it. I’m not even sure if, while the page loads, you can test of speed and if it’s fast enough then add the javascript.

    If there was a way, it would certainly be an interesting one. Most likely will be php

    #58883
    soap
    Participant

    Maybe it’s possible to have a link remove the line of code for the external script and refresh while keeping that line of code removed. Possibly accomplished with AJAX? Unsure. Sounds like maybe you should slim that javascript down ;)

    #58885
    noahgelman
    Participant

    @soap, I think the goal is to do it without refreshing.

    Can you do conditional scripts for certain operating systems or page speeds like you do for IE? Or an if else statement of some kind with php or javascript?

    Or maybe, if you have it in a div like this:



    Can you just just some javascript to delete the #script-holder element? Would that stop the javascript from functioning or would it still since it’s already cached?

    #58758
    Eightyk
    Member

    How about having the hyperlink change what the script does? (off) and then setting it back to normal (on) ??

    #58759
    Eightyk
    Member

    I may have found the answer… I’m just not sure how to implement it. check this out.

    http://developerssolutions.wordpress.com/2010/07/28/load-css-dynamically/

    #58760
    soap
    Participant

    Well if you do it with AJAX it’s not technically refreshing.. :D

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.