| 12:46 am on Jun 28, 2002 (gmt 0)|
<a href="#" onClick="popupPage('something.html')">text</a>
<a href="something.html" onClick="popupPage('something.html');return false;" target="_blank">text</a>
This is also great for links where you want a j/s popup box that says something like "Are you sure, yes/no". Just return true/false back to the onClick parameter and without j/s, it defaults to 'yes'. This also works for onClick's for submit buttons in forms. I hate all those submit buttons where you can only submit if j/s is enabled b/c of client side validation code.
Anyway, I just ran into this. Perhaps it isn't news to many of you, I dont know.
| 7:03 am on Jun 28, 2002 (gmt 0)|
Yup, I've used the popup trick myself.
But for form submissions, I wouldn't pop up an "are you sure?" dialogue. It's far more effective to return a copy of the filled-in form and provide buttons to "Submit" and "Edit". Users are more likely to spot errors that way.
Arrange for the form validation script to return true for a correctly filled-in form, and false if it contains errors. Then include the following event handler in the <form> tag:
Well, on re-readingyour original post, I guess you didn't mean quite what I thought you said about form submissions -- but I still stand by what I said. :)
| 8:04 pm on Jul 1, 2002 (gmt 0)|
I thought a while back someone mentioned that this fails in some browsers (let me guess, NS 4.x?) because they give precedence to the link, not the onclick event, so that even if the browser has JS on, it will still follow the href link, rather than the link in the onclick event.
Does that ring any bells?