您当前的位置: 首页 >  Java

梁云亮

暂无认证

  • 2浏览

    0关注

    1211博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

JavaScript测试题

梁云亮 发布时间:2019-12-06 17:29:48 ,浏览量:2

一、选择题

针对以下题目,请选择最符合题目要求的答案。针对每一道题目,所有答案都选对,则该题得分,所选答案错误或不能选出所有答案,则该题不得分。每题2分)

  1. 在javascript中,系统时间为“2012-2-20”,调用Date对象的getMonth()方法得到的结果是(). (选择一项) A. 2 B. 3 C. 1 D. 什么都不显示

  2. 在javascript中,下列正则表达式的重复字符描述不正确的是() (选择一项)

    A. {n} 匹配前的一项n次 B. * 匹配前一项0次或多次 C. + 匹配前一项1次 D. {n},匹配前一项n次,或者多次

  3. 在javascript中,下列代码可以实现弹出的窗口不可调节尺寸的是()。 (选择二项) A. window.open(“test.html”,”弹出窗口”,”resizable=no”); B. window.open(“test.html”,”弹出窗口”,”resizable=yes”); C. window.open(“test.html”,”弹出窗口”,”resizable=0”); D. window.open(“test.html”,”弹出窗口”,”resizable=1”);

  4. 在javascript中,下列方法中相当于客户端点击F5(刷新)的是(). (选择二项)

    A. document.replace(); B. document.reload(); C. location.replace(location.href); D. location.reload();

  5. 在javascript中,下列选项中能够得到最后一个“Mary”的是(). var str = “this is Mary She is Mary”; (选择二项) A. var a = str.substring(str.indexOf(“Mary”,13)); B. var a = str.substring(str.indexOf(“Mary”,13),str.length); C. var a = str.substring(str.indexOf(“Mary”)); D. var a = str.substring(str.indexOf(“Mary”),str.indexOf(“Mary”)+4);

  6. 在javascript中,下列选项能把“毒皇后”这一行删除的是(). (选择一项)

    
    	
    		七个小矮人
    		7
    	
    		
    		毒皇后
    		100
    	
    	
    		白雪公主
    		8
    	
    
    

    A. document.getElementById(“td”).deleteRow(1); B. document.getElementById(“td”).deleteRow(2); C. document.getElementById(“td”).deleteRow[1]; D. document.getElementById(“td”).deleteRow[2];

  7. 在javascript中,以下对字符串 varStr = “Thank You”的操作,说法正确的是(). (选择二项) A. varStr.substring(1,5)返回值是”Than” B. varStr.length返回值为9 C. varStr.indexOf(“You”)返回值为7 D. varStr.toUpperCase()的返回值为”THANK YOU”

  8. 在javascript中,以下变量命名不合法的是(). (选择一项) A. num_1 B. 2num C. sum D. n2$c

  9. 在javascript中,以下选项可以重新加载当前面的是(). (选择一项) A. history.reload() B. location.reload() C. history.reload() D. location.refresh()

  10. 在javascript中,可以使用窗口“后退” 显示前一个页面的代码是() (选择二项)

    A. history.back() B. history.goBack() C. history.back(-1) D. history.go(-1)

  11. 在javascript中,当按下回车键时会触发onkeydown事件,则event.keyCode的值为(). (选择一项) A. 10 B. 31 C. 13 D. 65

  12. 在javascript中,以下选项()可以关闭当前浏览器窗口。 (选择一项)

    A. 	关闭窗口
    B.	关闭窗口
    C.	关闭窗口
    D.	关闭窗口
    
  13. 有如下javascript代码,要验证邮箱中是否包含“@”和“.”,以下选项正确的是() var mail = document.getElementById(“email”).value; (选择两项) A. if(mail.indexOf(“@”)1){ alert(“Email格式不正确,必须包含@”) return false; } B. if(mail.charAt(“@”)-1){ alert(“Email格式不正确,必须包含@”) return false; } C. if(mail. indexOf (“.”)–1){ alert(“Email格式不正确,必须包含. ”) return false; } D. if(mail. charAt (“.”)–1){ alert(“Email格式不正确,必须包含. ”) return false; }

  14. 在javascript中,要验证输入学号的文本框不能为空,正确的代码为()。 (选择一项) A. var id = document.getElementById(“ID”).value if(id==””){ alert(“ID不能为空”); return false; } B. var id = document.getElementById(“ID”).Text; if(id==””){ alert(“ID不能为空”); return false; } C. var id = window.getElementById(“ID”).value; if(id==””){ alert(“ID不能为空”); return false; } D. var id = window.getElementById(“ID”).Text; if(id==””){ alert(“ID不能为空”); return false; }

  15. 在javascript中,关于以下代码,说法正确的是(). (选择一项) var s = document.getElementByTagName(“div”); for(var i=0;i

关注
打赏
1665409997
查看更多评论
立即登录/注册

微信扫码登录

0.1712s