[nycphp-talk] Need some JS / HTML help
David Krings
ramons at gmx.net
Sun Dec 23 09:06:00 EST 2007
nasir81 at gmail.com wrote:
> Sorry, didn't mean to send a short and Curt reply. Javascript:void(0) in the herf will stop the browser from navigating away from the current page. i have used it in similar situations, where an onclick is required.
That doesn't seem to work the way I want to. It appears as that the href takes
precedence over the onClick, which basically causes the link to do nothing.
Yes, Javascript:void(0); prevents naviagtion away from the page, but it also
disables the onClick code. I tried it in both Firefox and IE, and while
Firefox just doesn't do anything IE complains about a semicolon missing in a
spot where I put a semicolon. Microsoft's error messages are always beyond
useless.
I went back to using href="" instead, which appears to work OK.
I expanded my function to accept a different parameter so that it can create a
plain simple link. That makes it easier even when someone finds a good way to
detect JS, it needs to be done only once and the parameter to be passed can be
set accordingly.
Thanks for your help.
David
More information about the talk
mailing list