<script type="text/javascript">//这里的try{……}catch(e){……} 代替 if……else……语句,避免浏览器出现错误信息。function addEvent( obj,type,handle ){try{ //Chrome、Safari、Firefox、Opera、IE9.0及其以上版本object.addEventListener(type,handle,false);}catch(e){try{ //IE8.0及其以下版本object.attachEvent('on',type,handle)}catch(e){ //早起浏览器obj['on'+type] = handle;}}}</script>
1500字范文,内容丰富有趣,写作好帮手!