Click to See Complete Forum and Search --> : a href and javascript


pelegk1
12-14-2003, 02:45 AM
i want from an "<a href="javascript:xxx();>"
to call a javascript function
but when i do it it redirects me to a page with the name of the
js function!
how do i prevent it?
thanks in advance
peleg

TomDenver
12-14-2003, 02:53 AM
You have a missing end quotation in your example. It should read:

<a href="javascript:xxx();">

pelegk1
12-14-2003, 02:57 AM
when i copy it
but it isnt solving the problem

Pittimann
12-14-2003, 03:16 AM
Hi!

If you had posted the full tag, I could (perhaps) give you a reply which is 100% satisfying for you.

So, this is not more than an assumption: you have a target attribute in your tag - just remove it...

Cheers - Pit

pelegk1
12-14-2003, 03:32 AM
all i want is when the link of the href is pressed to call to a js function that all

Pittimann
12-14-2003, 03:38 AM
Hi!

Your tag does not simply look like:
<a href="javascript:xxx();">click me</a>

My assumption is, that it rather looks like:
<a href="javascript:xxx();" target="_blank">click me</a>

Cheers - Pit

BTW - you could have posted your tag...

pelegk1
12-14-2003, 03:53 AM
<a href="javascript:xxx();">click me</a>

pelegk1
12-14-2003, 06:16 AM
<a href="#" onPress="javascript:xxx();">>click here </a>

Pittimann
12-14-2003, 06:21 AM
Hi!

You're a magician! :confused:

Cheers - Pit

ray326
12-14-2003, 12:54 PM
Did you ever try:

<a href="javascript:xxx();return(false);">click me</a>

fredmv
12-14-2003, 01:08 PM
Originally posted by pelegk1
<a href="#" onPress="javascript:xxx();">>click here </a> That isn't even a valid event handler. I'm sure what you were looking for is:<a href="#" onclick="xxx();">click here</a>You shouldn't ever use the JavaScript pseudo-protocol for exeucting JavaScript code when event handlers are available to you; the only exception of this is when you're creating bookmarklets.

pelegk1
12-15-2003, 02:44 AM
sorry your correct copied it incorrectly

fredmv
12-15-2003, 02:45 AM
No problem. :D