IE 6 location.href Problems

Have you noticed sometimes , how simple things just refuses to work in IE6 …location.href is just such a thing.

If you have added an onclick function to your anchor tag like below …

<a href=”javascript:void(0);” onclick=”onClickLink(‘xxx’);” > go to new location </a>

With some function like this…
function onclickLink(id){
var URI = “test2.html?id=”+id;
window.location.href = URI;
}

To your irony, you would notice that such a piece of simple script refuses to work in IE …  Well! I can discuss reasons here,  but not think it will be worthwhile … Though , I do seem to have a solution… ( I bet if you understand Javascript, you will understand , why we add this tweak for IE6)

The Solution

<a href=”javascript:void(0);” onclick=”onClickLink(‘xxx’);return false;” > go to new location </a>

If you any simple answers , please do write a comment. It will really be appretiated, I bet , by Many!


Leave a Reply

 
NDK home | Expressing IT | Expressing Palate | Expressing Penmenship | Expressing Awe | Expressing Myself