开发者

Onclick Event Issue in IE 7

I'm thoroughly confused now. Exclusively in IE7 my onclick function fails to execute. However, when I run it in IE's console, it works just fine.

I've tried the following combinations:

onclick="loadStatsRSH('h',2)" href="javascript:void(0)"
onclick="loadStatsRSH('h',2);return false;" href开发者_如何学运维="javascript:void(0)"
onclick="loadStatsRSH('h',2);return false;" href="#"
onclick="loadStatsRSH('h',2)" href="#"
onclick="javascript:loadStatsRSH('h',2);return false;" href="#"
onclick="javascript:loadStatsRSH('h',2);" href="javascript:void(0)"

There are other which I've tried, but now I feel its getting silly. Can anyone give me a hint why IE7 would complain about my onclick?


It works fine here: http://jsfiddle.net/jfriend00/KHY52/ in any version of IE I try it in with this HTML:

<a onclick="loadStatsRSH('h',2);return false;" href="#">Click here</a>

One possibility is that your loadStatsRSH function isn't in the global scope and thus the browser can't find it (though it would be unlikely that that would be a problem in only IE).

If you want further help, the problem is probably caused by parts of your web page that you haven't disclosed as there is nothing wrong with the choices you have above. I'd suggest describing/showing more of your HTML and more of your script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜