1、哪个操作是W3C标准定义的阻止事件向父容器传递:
答案:e.stopPropagation()
答案详解:
DOM中的事件对象:(符合W3C标准)
preventDefault() 取消事件默认行为
stopImmediatePropagation() 取消事件冒泡同时阻止当前节点上的事件处理程序被调用。
stopPropagation() 取消事件冒泡对当前节点无影响。
IE中的事件对象:
cancelBubble() 取消事件冒泡
returnValue() 取消事件默认行为
2、写出下面代码的运行结果
var a,b;
(function(){
alert(a);
alert(b);
var a=b=3;
alert(a);
alert(b);
})();
alert(a);
alert(b);
答案:undefined,undefined,3,3,undefined,3
答案解析: undefined,undefined,3,3,undefined,3
3、名为“ctx”的变量是某个HTML5画布对象的上下文。以下代码绘制的是什么()
Ctx.arc(x,y,r,0,Math.PI,true);
答案:在给定点绘制一个半圆
4、下拉菜单中,用户更改表单元素Select中的值时,就会调用( )事件处理程序