javascript toggle

Out of context: Reply #6

  • Started
  • Last post
  • 7 Responses
  • kappa0

    If I have this right, you want to LINK to a file that might be on one of a number of servers, right?

    that's not too hard at all.

    <a href="void(0)" onClick="doToggle('the/file/here...

    the SIMPLE js:

    tState = true;
    function doToggle(fileURL) {
    if(tState) document.location.href = 'http://server1.com/' + fileURL;
    else document.location.href = 'http://server2.com/' + fileURL;

    tState != tState;
    }

    this is the simple version, it can be far my dynamic, email me if you need more.

View thread