The problem that the label href and onclick both exist in IE6
Recently, a project (a Web page that displays weather forecasts) needs to use ajax to retrieve weather forecast data from the server.
After that, I tested IE7 on my computer and passed the test under ff2 and ff3.
After the launch, some colleagues failed to respond to the weather forecast and found that the browser was IE6. I immediately looked at the data with httpwatch and found that when I clicked the request under IE6, the returned status was aborted (that is, the request was interrupted ). Why ......
After several Google searches, I finally found the cause: the request link uses the tag, and the href and onclick events are simultaneously written on. For the link to tag a, when the user clicks the mouse, when object A is triggered, The onclick part is executed first, and then the href part is executed. If it is IE6, onclick is executed, send an HTTP request (the weather forecast requires asynchronous data requests ). Execute href instantly. Then IE6 will abort the previous request.
Solution: directly write The onclick event in href: href = "javascript: Do ()"
There is also a solution: <a href = "javascript: void (0)" onclick = "Do (); Return false;"> test </a>
In this way, the href part is ignored, which is useful for passing this through onclick or avoiding object.
From: http://www.cnblogs.com/phpliu/archive/2010/02/25/1673794.html
Recently, a project (a Web page that displays weather forecasts) needs to use ajax to retrieve weather forecast data from the server.
After that, I tested IE7 on my computer and passed the test under ff2 and ff3.
After the launch, some colleagues failed to respond to the weather forecast and found that the browser was IE6. I immediately looked at the data with httpwatch and found that when I clicked the request under IE6, the returned status was aborted (that is, the request was interrupted ). Why ......
After several Google searches, I finally found the cause: the request link uses the tag, and the href and onclick events are simultaneously written on. For the link to tag a, when the user clicks the mouse, when object A is triggered, The onclick part is executed first, and then the href part is executed. If it is IE6, onclick is executed, send an HTTP request (the weather forecast requires asynchronous data requests ). Execute href instantly. Then IE6 will abort the previous request.
Solution: directly write The onclick event in href: href = "javascript: Do ()"
There is also a solution: <a href = "javascript: void (0)" onclick = "Do (); Return false;"> test </a>
In this way, the href part is ignored, which is useful for passing this through onclick or avoiding object.