You need to tell the browser not to follow the link with the onlcick event:
<a href="mylink.cfm" onClick="alert(this); return false;"> Spike >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of >Taco Fleur >Sent: Sunday, February 08, 2004 2:47 PM >To: CFAussie Mailing List >Subject: [cfaussie] RE: [OT] JS to early or bug? > >What the??? > ><a href="javascript:alert(this);">« Back</a> Gives me >[object] which is what I am after, but shouldn't <a >href="mylink.cfm" onClick="alert(this);">test</a> do the same? >I'm sure I used it before. > >I was just debugging BTW, I was passing the object to a >function, but it said undefined, then I started debugging i.e. >alert(this) which should output [object] but instead output >the link..... > >In anycase, <a href="javascript:alert(this);">« Back</a> >works, so I am not going to worry any further, it's to early..... > >Thanks > >Taco Fleur >07 3535 5072 >Blog: http://www.tacofleur.com/index/blog/ >Methodology: http://www.tacofleur.com/index/methodology/ >Tell me and I will forget >Show me and I will remember >Teach me and I will learn > > >-----Original Message----- >From: Mark Stanton [mailto:[EMAIL PROTECTED] >Sent: Monday, 9 February 2004 8:37 AM >To: CFAussie Mailing List >Subject: [cfaussie] RE: [OT] JS to early or bug? > > >Hey Taco > >An <a> with an href already has an implied onclick event - >send a request for the url specified. So for <a> tags I think >its generally better to use <a >href="javascript:alert(this);">. Also the argument to alert is >meant to be a plain text string - not an object, not sure if >this is related to the problem though. > > >Cheers > >Mark > > >------------------ >Mark Stanton >Technical Director >Gruden Pty Ltd >Tel: 9956 6388 >Mob: 0410 458 201 >Fax: 9956 8433 >http://www.gruden.com <http://www.gruden.com/> > > >--- >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 > >--- >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 --- 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
