PDA

Click to See Complete Forum and Search --> : Hyperlinks that only fire if certain conditions are met.


hall
Apr 30th, 2001, 03:40 PM
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.

Wynd
Apr 30th, 2001, 05:11 PM
Try this:


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


Then:


<a href="javascript:checkstuff()">text here</a>