DOM issue of IE 8

I met a problem when manipulate DOM by Javascript in IE 8. For example like below:
<script type="text/javascript">
 function function1() {
  .....
 }
</script>

<input id="function1" type="button" onlick="function1()"/>
IE 8 will output an error message like this picture show.

This is because IE 8 will use DOM's ID to create global object. And it will course to conflict to your function object. The solution is change your function name and avoid to be the same as any DOM's ID.
Conference: Internet Explorer Global Variable Blow ups

留言

熱門文章