前端模拟试题.docJavaScript模拟试题
一、单选题
我们可以在下列哪个HTML元素中放置Javascript代码?
<script>
<javascript>
<js>
<scripting>
写"Hello World” 的正确 Javascript 语法就是?
("Hello World1*)
“Hello World”
response> write("Hello World*')
document、write(nHello World")
插入Javacript的正确位置就是?
<body> 部分
<head> 部分
<body>部分与<head>部分均可
引用名为"xxx、js”的外部脚本的正确语法就是?
<script src="xxx> js">
<script href=*'xxx> js">
<script name="xxx> js">
外部脚本必须包含<script>标签不?
就是
否
如何在警告框中写入“Hello World”?
alertBox=nHello World'1
msgBox(HHello World")
alert(HHello World”)
alertBox(nHello World11)
如何创建函数?
function:myFunction()
function myFunction()
function=myFunction()
如何调用名为"myFunction”的函数?
call function myFunction
call myFunction()
myFunction()
如何编写当i等于5时执行一些语句的条件语句?
if(i==5)
if i=5 then
ifi=5
if i==5 then
如何编写当i不等于5时执行一些语句的条件语句?
if =! 5 then
if <>5
if(i <> 5)
if(i !=5)
在JavaScript中,有多少种不同类型的循环?
两种。for循环与while循环。
四种。for循环、while循环、do、、、while循环以及loop、、、until循环。
一种。for循环。
for循环如何开始?
for (i <= 5; i++)
for (i = 0; i v= 5; i++)
for (i = 0; i <= 5)
for i = 1 to 5
如何在JavaScript中添加注释?
' This is a comment
<!—This is a comment—>
//This is a comment
可插入多行注释的JavaScript语法就是?
/*This comment has more than one line*/
//This comment has more than one line//
<!—This comment has more than one line—>
定义JavaScript数组的正确方法就是?
var txt = new Array="George","John","Thomas"
var txt = new Array(l:"George",2:"John",3:"Thomas")
var txt = new Array("George"," John",''Thomas")
var txt = new Array: l=("George")2=("John")3=("Thomas") 、25四舍五入为最接近的整数?
round(7> 25)
rnd(7、 25)
Math、md(7、25)
Math> round(7> 25)
如何求得2与4中最大的数?
Math> ceil(2,4)
Math> max(2,4)
ceil(2,4)
top(2,4)
打开名为"window2”的新窗口的JavaScript语法就是?
open> new("","window2")
new、window("","window2*')
new(Hn,nwindow2n)
window> open("",nwindow2n)
如何在浏览器的状态栏放入一条消息?
statusbar = "put your message here"
window> status = "put your message here"
window> status("put your message here")
status(nput your message here")
如何获得客户端浏览器的名称?
client >
前端模拟试题 来自淘豆网m.daumloan.com转载请标明出处.