首页 > JavaScript 我看学习资料,onload 是event 的属性,怎么加在window 后面?

JavaScript 我看学习资料,onload 是event 的属性,怎么加在window 后面?

我看学习资料,onload 是event 的属性,怎么都看到 都是 window.onload = function()?

event是个什么东西?
我用.__proto__也看不出来..

请问 event 和 window 什么关系?

我自己做实验试出来了!!!

我知道了,原来得有了事件后,才会创建一个 event 对象:


<body onkeyup="whichButton(event)">

<script>


function whichButton(event)
{
    console.group("event");
    alert(event.keyCode);
    console.log( event.__proto__);
    console.log( event.__proto__.__proto__);
    console.log( event.__proto__.__proto__.__proto__);    
    console.log( event.__proto__.__proto__.__proto__.__proto__);            
    console.groupEnd();
}
</script>
【热门文章】
【热门文章】