Why [removed]void(0) is not working in Firefox

前端 未结 2 1217
旧巷少年郎
旧巷少年郎 2021-01-16 20:56

Why is this simple link example not working in Firefox? It is working in IE and Chrome.
js fiddle sample
I am using windows XP. My Firefox version is 16.0.

2条回答
  •  离开以前
    2021-01-16 21:41

    Your fiddle sample shouldn't work in any browser because you've defined the getItems() method inside the onload handler that is the jsfiddle default (as set on the left-hand side) which in turn means that it is not in scope from the inline onclick="getItems()" attribute.

    It works in FF if you fix that by selecting no wrap (head) instead of onLoad, thus making your function global: http://jsfiddle.net/u6bKr/1/

    (Note that this has nothing to do with href="javascript:void(0);")

提交回复
热议问题