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
    Lively Member chrisgaddy's Avatar
    Join Date
    Mar 2001
    Location
    Olive Branch, MS
    Posts
    71
    Yes you can! Set up your hyperlink like this:

    Code:
      <a href="vbscript: checkValues()">My Link</a>
    Now create your function to check the values you want to change. After you check the values in your function use document.url:

    Code:
      document.url = "http://www.yahoo.com"
    This example was for javascript. Not sure what the function for javascript would be...I'll dig around and see. Document.url may work.

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