js - script标签的for属性和event属性

js - script标签的for属性和event属性

<script language="javascript" for="window" event="onload">
alert("hello word!");
</script>
// for 属性指定脚本执行对象(给谁用的)
// event 属性指定脚本执行事件(在什么时候执行)
// 上面的代码相当于:
$(document).ready(function(){alert("hello word!");}

注:只有IE支持这种语法

posted @   zc-lee  阅读(418)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示