相应的JavaScript代码如下:
functioninitialClock(){//<<插入代码>>;};functiontimerFunc(){varv=newDate();document.getElementById("mySpan").innerHTML=v.toLocaleTimeString();}现需要在span元素中实现动态时钟的显示,”插入代码“处所需要的代码是(B)。
A.window.setInterval(timerFunc,1000);
B.window.setInterval(timerFunc(),1000);
C.window.setTimeout(timerFunc,1000);
D.window.setTimeout(timerFunc(),1000);
25.(单选题)需要在原有浏览器窗口中打开地址为的页面,且保留历史访问记录。
下列选项中,正确的是(D)。
A.location.href="";
B.window.open("");
C.location.replace("");
D.history.go("");
26.(单选题)关于event对象,下列描述中,错误的是(D)。
A.任何事件触发后将会产生一个event对象
B.event对象记录事件发生时的鼠标位置、键盘按键状态和触发对象等信息
C.event对象的cancelBubble属性,用于设置是否取消事件冒泡
D.event对象的srcElement属性,用于获取触发事件的节点对象(Window对象、Document对象或Element对象的引用。
)
27.(单选题)有变量obj表示页面上的某个元素。
现需要修改该元素的显示方式即将该元素显示为行内元素。
下列选项中,正确的是(A)。
A.obj.style.display='inline';
B.obj.style.display='none';
C.obj.style.show='inline';
D.obj.style.show='none';
28.(单选题)HTML页面上有一个超级链接,要实现当鼠标移入该超级链接时,超级链接的文本背景色变为灰色。
下列选项中,能实现此功能的是(D)。
A.
B.
C.
D.
29.(单选题)如果不给cookie设置过期时间,那么cookie默认保存时间是(C)。
A.立刻过期
B.cookie无法设置
C.在浏览器会话结束时过期
D.永不过期
30.(多选题)有html代码如下:
varlist=document.getElementById('datas');现需要将html代码中的列表框,修改为下拉列表框。
下列选项中,正确的是(AB)。
A.list.removeAttribute("size");
B.list.removeAttributeNode(list.attributes[1]);
C.list.removeAttributeNode("size");
D.list.removeAttribute(list.attributes[1]);
31.(多选题)有html代码如下:
A.document.getElementsByTagName('state')[1].attributes["value"].value
B.document.getElementsByName('input')[1].attributes["value"].value
C.document.getElementsByTagName('input')[1].attributes["value"].value
D.document.getElementsByName('state')[1].attributes["value"].value
32.(多选题)有html代码如下:
A.document.getElementById("t1").setAttribute("value","aa");
B.document.getElementById("t1").innerHTML="bb";
C.document.getElementsByTagName("input")[0].setAttribute("value","cc");
D.document.getElementsByTagName("input")[0].innerHTML="dd";
33.(多选题)有html代码如下:
void(0);">XX搜索还有JavaScript代码如下: vara=document.getElementById("bdlink");为了将该超级链接元素的href属性的值修改为“#”,下列选项中,正确的是(AC)。 A.a.attributes["href"].value="#"; B.a.attributes["href"]="#"; C.a.setAttribute("href","#"); D.a.setAttributeNode("href","#");(ERROR) 34.(多选题)有html代码如下: void(0);">XX搜索还有JavaScript代码如下: vara=document.getElementById("bdlink");为了获取该超级链接元素的href属性的值,下列选项中,正确的是(ABCD)。 A.a.attributes["href"].value B.a.getAttribute("href") C.a.attributes[1].value D.a.getAttributeNode("href").value 35.(单选题)查看如下代码: varstr="1<2";console.log(str);console.log(eval(str));执行后的结果是(A)。 A.1<2和true B.true和true C.先输出1<2,然后程序错误 D.以上均不对 36(单选题)有下述JS代码: vari=0;varsum=0;do{i++;if(i%2===0){continue;}if(i%5===0){break;}sum+=i;}while(i<10);console.log('sum='+sum);其运行结果应该是下列哪项(B)。 A.sum=0 B.sum=4 C.sum=Infinity D.死循环 38.(单选题)有html代码如下: varobj=document.getElementById("d1");varnewObj=document.createElement("p");newObj.innerHTML="text";obj.insertBefore(newObj,obj.firstChild);console.log(obj.innerHTML);上述代码的输出结果是(B)。 A. textbb
B.
text
bbC.bb
text
D.代码错误
39.(单选题)下列选项中,能够在新的浏览器窗口或者标签页中打开目标页面的是(C)。
A.location.href="";
B.history.go("");
C.window.open("");(新窗口打开)
D.location.replace("")(本窗口打开)
40.(单选题)查看如下代码:
varx="10";functionf1(x){x=x+2;returnx;}console.log(x);x=f1(x);console.log(x);执行
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1