Sunday, May 19, 2024
148
rated 0 times [  154] [ 6]  / answers: 1 / hits: 24567  / 15 Years ago, fri, may 8, 2009, 12:00:00

HI,



I am developing a web page using asp.net.



I am using some links in my web page. For that I have used some code like this.



<a href=javascript:void(0); onclick=javascript:ChangeLoc('TEST','');>Test</a>


and in the ChangeLoc() method I have written __doPostBack event.



This works fine in IE7 installed in my machine. But in IE6 in another machine it does not invoke the __doPostBack event.



Edit



When I change the void(0) in href it works fine.



I would like to know whether it is a bug with IE or a JavaScript problem.



function ChangeLoc( param, arg )
{
__doPostBack ( param, arg )
}

More From » internet-explorer

 Answers
208

href and onclick both get fired when you click an element, you are overwriting the onclick event with void()



change to



<a href=# onclick=ChangeLoc();return false>test</a>


or with jQuery.



$(function(){
$(#linkId).click(function(event){
ChangeLoc();
event.preventDefault();
});
});

[#99574] Monday, May 4, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jacie

Total Points: 490
Total Questions: 111
Total Answers: 105

Location: Mali
Member since Sat, Feb 12, 2022
2 Years ago
jacie questions
Tue, Aug 23, 22, 00:00, 2 Years ago
Mon, Apr 4, 22, 00:00, 2 Years ago
Fri, Aug 16, 19, 00:00, 5 Years ago
Fri, Jul 12, 19, 00:00, 5 Years ago
;