Kadjo » A href = "#" with javascript event onclick issue on IE

A href = "#" with javascript event onclick issue on IE

I have this kind of link on my code :


< a href = '#' onclick='javascript:window.open("http://somelocation.net/")'>somelocation </a>

The problem with this is that whenever this is clicked in a MS IE browser, both the original link and the new window is executed.
I was expecting that only the new window will be displayed and refresh. To solve this, i’ve changed my code to :


<href = '#' onclick='javascript:window.open("http://somelocation.net/");return false;' >
somelocation <a>

That solves the issue.

2 Comments on “A href = "#" with javascript event onclick issue on IE”

  • tildemark February 20th, 2009 2:12 pm

    How about using target attribute? target=”_blank”

  • C. Bess March 23rd, 2009 1:07 pm

    Magandang tanghali

    <a href=’javascript:void(0)’ onclick=’…’

    may be better

Leave a Reply