Results 1 to 2 of 2

Thread: Hyperlinks that only fire if certain conditions are met.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    28

    Hyperlinks that only fire if certain conditions are met.

    Help! Is there any way to have a hyperlink <a href = .......> fire conditionally or only if certain criteria are met. In other words, if the user clicks on the hyperlink, I want to first call a function to make sure that certain conditions are true, and if not, then cancel the navigation to the hyperlink. Unfortunately, I can’t use the “navigate “ function (I think it’s a function anyway) for this purpose which would have worked nicely. Any help would be greatly appreciated.

  2. #2
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Try this:

    Code:
    function checkstuff()
    {
      if (conditions)
        window.location = "somepage.html";
    }
    Then:

    Code:
    <a href="javascript:checkstuff()">text here</a>
    Alcohol & calculus don't mix.
    Never drink & derive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width