当前位置:网站首页>八、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>
边栏推荐
- Application scenario: wide application of Poe network card in NDI technology for live broadcast program production
- One article to show you how to understand the harmonyos application on the shelves
- 从概率论基础出发推导卡尔曼滤波
- Solution to the problem of PHP strtotime obtaining natural monthly error
- Why should I use iwarp, roce V2, nvme of and other protocols for 100g network transmission
- [Part 13] source code analysis and application details of completabilefuture class [key]
- JVM之堆区
- JS performs non empty judgment on various data types of the returned data.
- Diary at 16:29:41 on June 9, 2022
- Solve the problem of img 5px spacing
猜你喜欢

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

The scale of the global machine vision market continues to rise. Poe image acquisition card provides a high-speed transmission channel for industrial cameras

Pyqt5 technical part - set the default value of qcombobox drop-down box and get the current selection of the drop-down box

Obsidian关系图谱如何让节点可以手动拖动

2021牛客多校5 Double Strings

解决 img 5px 间距的问题

【C語言進階】整型在內存中的存儲

Answer fans' questions | count the number and frequency of letters in the text

JS performs non empty judgment on various data types of the returned data.

Test plans and test cases
随机推荐
Codeforces Round #740 Div. 2 解题报告
New product release: lr-link Lianrui launched the first 25g OCP 3.0 network card
[game theory complete information static game] strategic game
Field queryIndexFieldnameService in xxxImpl required a single bean, but 19 were found:
Leetcode 797. All possible paths
可综合RTL代码设计方法和注意事项
12 golden rules of growth
Cuckoo Hash
One article to show you how to understand the harmonyos application on the shelves
Educational Codeforces Round 111 (Rated for Div. 2) C 补题
2022年6月9日 16:29:41 日记
Codeforces Round #744 (Div. 3) 解题报告
The scale of the global machine vision market continues to rise. Poe image acquisition card provides a high-speed transmission channel for industrial cameras
Application analysis of Poe image acquisition card in machine vision industrial computer
Realize the same length of tablayout subscript and text, and change the selected font size
[Game Theory - introduction]
Simple classification example of brain cell membrane equivalent neural network
JVM之堆区
Serval and rooted Tree (cf1153d) - DP
Database daily question --- day 9: salesperson