[Javascript] link onclick=location.href not working

Lau@goldenweb.com.au lau at goldenweb.com.au
Tue Mar 30 03:11:34 CST 2004


I'm having trouble changing the window.location.href from the onclick event
of a link. using IE5.0
It works if the link is wrapped around a button but if its wrapped around
text or an image.

This works
<A HREF='#aa' onclick='window.location.href =
"http://www.google.com";'><INPUT TYPE=BUTTON VALUE="BUY"></A>

but this doesn't
<A HREF='#aa' onclick='window.location.href =
"http://www.google.com";'>aaaa</A>

In my actual code I have a function in the onclick that determines the URL
to assign.

It works in IE6.0 but I need to get it working in all browsers.

Could you please test this on your version browser and let me know if it
works or not?

And what workaround can I use.

Thanks in advance
Lau




More information about the Javascript mailing list