On 22 Jan 2004 10:59:42 -0800, Radioactive Man <up***********@yahoo.com>
wrote:
How come I can do this:
<a onclick="javascript:myfunc(this)">blah</a>
but I cannot do this:
<a href="javascript:myfunc(this)">blah</a>
For some reason the THIS reference doesn't work when used in href.
Any help?
Don't use JavaScript pseudo-protocol URIs. It's a simple as that.
If it works with the intrinsic event, why are you worried anyway?
JavaScript URIs are generally discouraged because they offer no way to
specify alternative content for users that have JavaScript disabled on
their systems. Also, as you have discovered, the pseudo-protocol can cause
problems that can be avoided by using another approach.
Unless you *really* need to use a JavaScript URI[1] in a link, use the
onclick event.
Mike
[1] I think anything that can be performed through a JavaScript URI can be
acheived some other way, though it might take more work.
--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)