Yes, it's beside the point. There's nothing wrong with using onclick on an a
tag -- you just have to add return false if appropriate. Makes no difference
to your situation though.

Here, try this:

<a id="hi" href="javascript:alert(this.id);">1</a> 
<a id="yo" href="mylink.cfm" onClick="alert(this.id);return false;">2</a>

It seems that in the second case, this refers to the a tag. In the first
case it *doesn't refer to the a tag. Perhaps it refers to the JS block?



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:bounce-cfaussie-
> [EMAIL PROTECTED] On Behalf Of Taco Fleur
> Sent: Monday, 9 February 2004 11:28 a.m.
> To: CFAussie Mailing List
> Subject: [cfaussie] RE: [OT] JS to early or bug?
> 
> A <a href="..."> already has an onclick event. You're asking your humble
> <a>
> tag to do two things when you click it - that's generally bad news.
> __________
> 
> But isn't that all besides the point?
> 
> No one has still been able to tell me exactly why
> 
> <a href="#" onClick="alert(this);"> returns 'http://blah.com/page.cfm#'
> And
> <a href="javascript:alert(this);"> returns the object
> 
> Or has anyone explained?
> 
> I'm doing pretty bad today, mentally and physically, had another nasty
> run-in with the Aussie sun again, maybe I have a sunstroke? ;-))
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to leave-cfaussie-
> [EMAIL PROTECTED]
> 
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
> http://www.mxdu.com/ + 24-25 February, 2004




---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to