当前位置:网站首页>八、BOM - 章节课后练习题及答案
八、BOM - 章节课后练习题及答案
2022-06-11 21:23:00 【熊先森的宝】
第一章链接:初识JavaScript - 章节课后练习题及答案
第二章链接:JavaScript 基础(上) - 章节课后练习题及答案
第三章链接:JavaScript 基础(下) - 章节课后练习题及答案
第四章链接:JavaScript 函数 - 章节课后练习题及答案
第五章链接:JavaScript 对象 - 章节课后练习题及答案
第六章链接:DOM(上) - 章节课后练习题及答案
第七章链接:DOM(下) - 章节课后练习题及答案
注:使用的是人民邮电出版社出版的《JavaScript+jQuery 交互式 Web 前端开发》书籍。
一、填空题
1、 在BOM中,所有对象的父对象是______。
2、页面中所有内容加载完之后触发的事件是______。
3、history对象的______属性可获取历史列表中的URL数量。
4、 ______事件是在DOM结构加载完触发的 。
二、判断题
1、全局变量可以通过window对象进行访问。( )
2、修改location对象的href属性可获取或设置URL。( )
3、使用clearTimeout()和clearInterval()可以清除定时器。( )
4、使用history对象的 go()方法可以实现页面前进或后退。( )
三、选择题
1、下列选项中,不是window对象的属性的是( )。
A. pageX B. location C. history D. navigator
2、下面关于BOM对象的描述,错误的是( )。
A. go(-1)与back()皆表示向历史列表后退一步
B.通过confirm()实现的“确认”对话框,单击“确认”时返回true
C. go(0)表示刷新当前网页
D.以上选项都不正确
3、下列描述错误的是( )。
A. onload和DOMContentLoaded都是页面加载事件,没有区别
B. DOMContentLoaded有浏览器兼容问题
C. 定义在全局作用域中的变量是window对象的属性
D. window对象的方法在调用时可以省略不写window
四、编程题
编写程序,实现电子时钟自动走动的效果,并提供一个按钮控制电子时钟是否停止走动。
参考答案:
一、填空题
1、window
2、window.onload
3、length
4、document.DOMContentLoaded
二、判断题
1、对 2、对 3、对 4、对
三、选择题
1、A 2、D 3、A
四、编程题
编写功能代码,具体代码如下:
<a id = "time"></a> <button onclick = "clearInterval(time1)">停止</button> <script type="text/javascript"> var time1 = window.setInterval('timeShow()', 1000); timeShow() function timeShow() { var today = new Date(); //获得系统当前时间 var intYears = today.getFullYear(); //获得年 intMonths = today.getMonth() + 1; //获得月份+1 intDates = today.getDate(); //获得天数 intHours = today.getHours(); //获得小时 intMinutes = today.getMinutes(); //获得分钟 intSeconds = today.getSeconds(); //获得秒 intWeeks = today.getDay(); //获得星期 // 修改格式为 *年*月*日 years = intYears + '年'; // 如果月份小于10,在月份前面加0 intMonths < 10 ? months = '0' + intMonths + '月' : months = intMonths + '月'; // 如果日份小于10,在日前面加0 intDates < 10 ? dates = '0' + intDates + '日' : dates = intDates + '日'; // 修改星期格式 var week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] weeks = week[intWeeks] + ' '; // 修改小时格式 if (intHours == 0) { hours = '00:'; } else if (intHours < 10) { hours = '0' + intHours + ':'; } else { hours = intHours + ":"; } // 修改分钟格式 if (intMinutes == 0) { minutes = '00'; } else if (intMinutes < 10) { minutes = '0' + intMinutes; } else { minutes = intMinutes+ ":"; } // 修改秒数格式 if (intSeconds == 0) { seconds = '00'; } else if (intSeconds < 10) { seconds = '0' + intSeconds; } else { seconds = intSeconds; } var timeString = years + months + dates + weeks + hours + minutes+seconds document.getElementById('time').innerHTML = timeString; } </script>
边栏推荐
- 为什么需要微服务
- Comprehensive RTL code design method and precautions
- One article to show you how to understand the harmonyos application on the shelves
- RANSAC提取平面(MATLAB内置函数)
- Product information | Poe network card family makes a collective appearance, the perfect partner of machine vision!
- LabVIEW控制Arduino实现超声波测距(进阶篇—5)
- Ubantu1804 two opencv versions coexist
- One article to show you how to understand the harmonyos application on the shelves
- Why is your LDO output unstable?
- Three waves of changes in cloud computing
猜你喜欢

第二部分 数据链路层
![[advanced C language] integer storage in memory](/img/a5/6c7df3b8f427fe724922a6b853516f.png)
[advanced C language] integer storage in memory

【博弈论-完全信息静态博弈】 战略式博弈

Goland中在文件模板中为go文件添加个人声明

Cs144 lab0 lab1 record

LabVIEW控制Arduino实现超声波测距(进阶篇—5)

Software test plan

Teach you how to use win7 system to quickly build your own website

Network security Kali penetration learning introduction to web penetration using MSF penetration to attack win7 host and execute commands remotely

UML系列文章(29)体系结构建模---模式和框架
随机推荐
JVM heap
RANSAC extract cylinder (matlab built-in function)
What are striplines and microstrip lines? Reference planes and transmission lines
为什么需要微服务
JUnit tests multithreaded code, and the sub thread does not run
Codeforces Round #742 (Div. 2) F. One-Four Overload
BUG -- coredump使用
Part II data link layer
Add personal statement for go file in file template in Golan
【 C Advanced language】 Integer Storage in Memory
Serval and Rooted Tree(CF1153D)-DP
Obsidian关系图谱如何让节点可以手动拖动
JMeter load test finds the maximum number of concurrent users (including step analysis)
In idea, run the yarn command to show that the file cannot be loaded because running scripts is disabled on this system
Application analysis of Poe image acquisition card in machine vision industrial computer
使用 SAP UI5 CLI 命令行工具构建和运行 SAP UI5 应用
Work assessment of spectral analysis of Jilin University in March of the 22nd spring -00079
Pyqt5 technical part - set the default value of qcombobox drop-down box and get the current selection of the drop-down box
【C语言进阶】整型在内存中的存储
【博弈论-完全信息静态博弈】 战略式博弈