如果要在网页上显示“20060816”,下划线处应该填写的JavaScript代码是()。(选择一项)var year=2006;
var month=8;
var date=16;
document.write(____);此处填写代码
a) year+0month+date
b) year+month+date
c) year+"0"+month+date
d) year 0 monthdate
答案C
分析下面的JavaScript代码,经过运算后m的值为()。(选择一项)
x=11;
y="number";
m=x+y;
a) 11number
b) number
c) 11
d) 程序报错
答案A
在JavaScript中,关于alert()和confirm()方法的说法正确的是()。(选择一项)
a) alert()和confirm()都是window对象的方法
b) alert()和confirm()方法功能相同
c) alert()方法的功能是现实一个带有“确定”和“取消”按钮的对话框
d) confirm()方法的功能是显示一个带有“确定”按钮的对话框
答案A
在HTML中,以下代码()可以正确显示如图所示的对话框。(选择一项)
confirm("欢迎学校.NET");
alert("欢迎学校.NET");
document.write("欢迎学校.NET");
document.open("欢迎学校.NET");
答案
下列HTML代码中,()能显示一个按钮,实现单击按钮时弹出一个显示“确定”的消息框,如下图所示。(选择一项)
答案
在HTML中,定义标签的样式为文本颜色为红色且无下划线的超链接样式,下列选项中能够实现此样式的语句是()。(选择一项)
a)
A{color:red;text-decoration:underline;}
b)
A{color:red;text-decoration:none;}
c)
A{color:red;border:none;}
d)
A{color:red;border:underline;}
答案B
在HTML中,下列选项( )中定义的样式实现了初始颜色为蓝色,鼠标悬浮时为红色且无下划线的超链接样式。(选择一项)
a) A{color:blue;text-decorate:none;}
A:hover{color:red;}
b) A{color=blue;text-decorate=none;}
A:hover{color:=red;}
c) A{color=blue;text-decoration=none;}
A:hover{color=red;}
d) A{color:blue;text-decoration:none;}
A:hover{color:red;}
答案B
在HTML页面中,定义样式设置按钮的背景图片为images文件夹下的background.jpg文件,需要将CSS的()属性赋值为url(images/background1.jpg)。(选择一项)
a) width
b) height
c) background-color
d) background-image
答案D
为了提取当前日期的小时数,并且判断如果当前的小时数小于12则在页面中显示“上午好!”,否则显示“下午好!”。下列JavaScript代码正确的是()。(选择一项)
a) var todays_date=new Date();
var seconds=todays_date.getSeconds();
var str=(seconds>12)?"上午好!":“下午好!”;
document.write(str);
b) var todays_date=new Date();
var seconds=todays_date.getHours();
var str=(seconds<12)?"上午好!":“下午好!”;
document.write(str);
c) var todays_date=new Date();
var seconds=todays_date.getSeconds();
var str=(seconds<12)?"上午好!":“下午好!”;
document.write(str);
d) var todays_date=new Date();
var seconds=todays_date.getHours();
var str=(seconds>12)?"上午好!":“下午好!”;
document.write(str);
答案B
假设今天是2006年4月1日星期六,请问以下javascript代码输出结果是:()
var time = new Date();
document.write(time.getDate());
a)2006
b)4
c)1
d)6
答案C
在JavaScript中,可使用Date对象的()方法返回一个月中的每一天。(选择一项)
a) getDate
b) getYear
c) getMonth
d) getTime
答案A
在JavaScript中,可以使用var today=new Date();这种方法获得系统当前日期和时间,假设系统当前日期为2007年7月2日星期一,则today.getDate()的返回值是()。(选择一项)
a) 1
b) 2
c) 7
d) 星期一
答案B
如果今天是2006年5月14日,分析下列JavaScript代码,运行后在网页上显示()。
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth();
var date = now.getDate();
document.write(year+" "+month+" "+date); (选择一项)
a) 2006 05 14
b) 2006 5 14
c) 2006 04 14
d) 2006 4 14
答案D
分析如下所示的HMTL网页代码,假设当前日期为2008年7月16日,则在浏览器中访问该页面时将显示()。(选择一项)
function showTime(){
var time=new Date();
document.forms[0].myCalendar.value=time.getYear()+"年"+time.getMonth()+"月
"+time.getDate()+"日";
}
a) 内容为空的文本框
b) 内容为空“2008年7月16日”的文本框
c) 内容为空“2008年6月16日”的文本框
d) 内容为空“2008年7月15日”的文本框
答案C
在HTML网页中有如下代码,假设当前时间为2007年7月4日星期3,网页上显示为()。(选择一项)
var now=new Date();
document.write("
现在日期:"+now.getYear()+"年"+now.getMonth()+"月
"+now.getDate()+"日");
a) 现在日期:2007年7月3日
b) 现在日期:2007年6月3日
c) 现在日期:2007年6月4日
d) 网页报错
答案C
分析下面的JavaScript代码,假如显示网页时,系统的时间为2006年2月20日15:54,那么网页上的输出为()。
var today = new Date();
document.write("现在时间是:"+today.getHours()+":"+today.getMinutes());
(选择一项)
a) 现在时间是:2006-02-20-15:54
b) 现在时间是:15:54
c) 现在时间是:00:00
d) 现在时间是:+15+:+54
答案B
在JavaScript中,可以使用Date对象的()方法返回一个月中的每一天。(选择一项)
a) getDate
b) getYear
c) getMonth
d) getTime
答案A
使用JavaScript制作输入提示的特效时,在文本框后加入一个div用于显示提示信息,如下div 的设置代码的作用是()。
(选择一项)
a) div与文本框处在同一行
b) div显示错误信息,字体为红色
c) 清除了div层中的初始化文本
d) div初始状态为隐藏
答案A
下列不是document对象的方法有()。(选择一项)
a) write()
b) getElementById()
c) getElementsByName()
d) bgColor()
答案D
在JavaScript中,关于document对象的方法下列说法正确的是()。(选择一项)
a) getElementById()是通过元素ID获取元素对象的方法,其返回值为单个对象
b) getElementsByName()是通过元素name获取元素对象的方法,其返回值为单个对象
c) getElementbyid()是通过元素ID获取元素对象的方法,其返回值为单个对象
d) getElementsbyname()是通过元素name获取元素对象的方法,其返回值为对象组
答案A
编写JavaScript函数实现网页背景色选择器,下列选项中正确的是()。(选择一项)
a) function change(color) {
window.bgColor = color;
}
b) function change(color) {
document.bgColor = color;
}
c) function change(color) {
body.bgColor = color;
}
d) function change(color) {
form.bgColor = color;
}
答案B
在HTML中,为了在页面中输出当前页面的URL地址,如图所示,下列JavaScript语句正确的是()。(选择一项)
a) document.write(document.location);
b) document.write(document.title);
c) document.write(document.body);
d) document.write(document.links);
答案A
在HTML中有如下代码,运行后页面显示结果为( )。
document.bgColor="#FF0000";
(选择一项)
a) 整个网页里面活动链接的颜色为红色
b) 整个网页里面文字颜色为红色
c) 整个网页里面用户访问过的链接的颜色为红色
d) 整个网页背景为红色
答案D
在JavaScript中要改变页面文档的背景颜色,需要修改document对象的()属性。
(选择一项)
a) backColor
b) backgroundColor
c) bgColor
d) background
答案C
在JavaScript中,对于浏览器对象的层次关系理解正确的是()。(选择二项)
a) window对象是所有页面内容的根对象
b) document对象包含location对象的history对象
c) location对象包含history对象
d) document对象包含form对象
答案AD
在HTML文档对象模型(DOM)中,最顶层的对象是()。(选择一项)
a) window
b) history
c) document
d) location
答案A
在DOM对象模型中,下列选项中的()对象位于DOM对象模型的第二层。(选择二项)
a) history
b) document
c) button
d) text
答案AB
HTML树形结构中,()是文档的根节点,位于结构中的最顶层。
A)
B)
C)
d)
答案A
在DOM对象模型中,直接父对象为根对象window的对象(换个说法是window对象的直接子对象)
中不包括()。(选择一项)
a) history
b) document
c) location
d) form
答案D
下列选项中关于JavaScript浏览器对象中history对象的说法错误的是()。(选择一项)
a) history对象记录了用户在一个浏览器中已经访问过的URLs
b) history对象的父对象是javascript浏览器对象的根对象window
c) 应用history对象的方法可以实现IE浏览器中“前进”和“后退”按钮的功能
d)应用history对象的back()方法相当于“前进”按钮,forward()方法相当于“后退”按钮
答案D
在HTML中,点击图片“previous.gif”上的超级链接后,页面将加载历史列表中的上一个URL页面,代码如下所示,应在下划线处填入()。(选择一项)
a) "javascript:history.go(-1);"
b) "history.go(1);"
c) "history.go(-1);"
d) "javascript:history.go(1);"
答案A
在HTML文档对象模型(DOM)中,history对象的( )方法用于加载历史列表中的下一个URL页面。(选择一项)
a) next()
b) history()
c) forword()
d) go(-1)
答案C
在HTML文档对象模型(HTML DOM)中,history对象的()方法用于加载历史列表中的上一个URL页面。(选择一项)
a) previous()
b) back()
c) forword()
d) go(1)
答案B
JavaScript的history对象提供类似浏览器前进和后退按钮的功能,以下能使浏览器后退一页的方法是()。(选择一项)
a) history.back(1)
b) history.forward(-1)
c) history.back()
d) history.back(-1)
答案C
以下 JavaScript代码,实现页面后退功能的是()。(选择二项)
a) 返回
b) 返回
c) 返回
d) 返回
答案BC
在HTML页面上包含如下所示的层对象,则JavaScript语句
document.getElementById("info").innerHTML的值是()。
请填写
a) 请填写
b)
请填写
c) id="info" style="display:block"
d)
请填写
答案B
HTML表单的首要标记是
a) document.form1.country.options.size=0;
b) document.form1.country.options.length=0;
c) document.form1.country.options.value="";
d) document.form1.country.value="";
答案B
在HTML中,以下JavaScript语句弹出的对话框中显示的值是()。(选择一项)
var a = 10;
var b = 5;
var c = 10/5;
if(c==0||a>5)
confirm(c+"很好");
else if(c>0 && a<5)
confirm(c+"一般");
else
confirm(c+"很差");
a) 2很好
b) 0很好
c) 2一般
d) 2很差
答案A
在HTML中,运行下面的javascript代码,则在弹出的提示框中显示的消息内容为()。(选择一项)
x=3;
y=2;
z=(x+2)/y;
alert(z);
a) 2
b) 2.5
c) 32/2
d) 16
答案B
在JavaScript中,for循环的语法结构是()。(选择一项)
a) for(初始化语句, 循环条件, 增量语句)
b) for(初始化语句)
c) for(初始化语句; 循环条件; 增量语句)
d) for(循环条件; 增量语句; 初始化语句)
答案C
JavaScript是一种脚本语言,有助于把静态页面转换为动态页面,下面对JavaScript语法规则的描述错误的是()。(选择一项)
a) JavaScript语句必须以分号(;)结束
b) JavaScript语言不区分大小写
c) JavaScript代码必须包含在HTML页面的
c)
和d)
和答案B
以下JavaScript代码中下划线处填入()语句可以使网页10秒钟后自动关闭。
_________
(选择一项)
a) setTimeOut('window.close()',10000);
b) setTimeOut('window.close()',10);
c) setTimeout('window.close()',10000);
d) setTimeout('window.close()',10);
答案C
分析如下所示的HTML页面代码,要实现每秒钟刷新时钟显示,应在下划线处添加的代码是()。(选择一项)
function showTime(){
var time=new Date();
document.forms[0].myClock.value=time.getHours()+":"+time.getMinutes()+":"+time.get Seconds();
_____________________//在此处添加代码
}
a) var myTime=setTimeout("showTime()",1);
b) var myTime=setTimeout("showTime()",1000);
c) var myTime=setTimeout(1);
d) var myTime=setTimeout(1000);
答案B
在javascript中,下列关于String对象的charAt()和indexOf()方法理解正确的是()(选择二项)
a)chatAt()方法是获取位置指定索引位置的字符
b)indexOf()方法是查找字符或字符串的位置,返回第一次出现的位置
c)chatAt()方法的参数可以为一个或两个
d)indexOf()方法的参数为指定的索引值
答案AB
JavaScript中定义字符串变量的方式是()。(选择一项)
a) String str = "abc";
b) string str = "abc";
c) Var str = "abc";
d) var str = "abc";
以下()语句可以为JavaScript中声明字符串类型变量。(选择一项)
a) String x = "APTECH";
b) string x = "APTECH";
c) var x = "APTECH";
d) var x = String("APTECH");
答案C
分析下面的JavaScript代码段,输出结果是()。(选择一项)
var mystring="I am a student";
a=mystring.charAt(9);
document.write(a);
a) I am a st
b) u
c) udent
d) t
答案B
分析下面JavaScript代码段,输出结果是()。(选择一项)
var mystring="I am a student";
var a=mystring.substring(9,13);
document.write(a);
a) stud
b) tuden
c) uden
d) udent
答案C
打开名为“window2”的新窗口的JavaScript语法是()。(选择一项)
a) open.new("https://www.doczj.com/doc/dc2125343.html,","window2")
b) window.open(https://www.doczj.com/doc/dc2125343.html,","window2")
c) new("https://www.doczj.com/doc/dc2125343.html,","window2")
d) new.window("https://www.doczj.com/doc/dc2125343.html,","window2")