js:bom,bom,bom

迷南。 2023-02-24 08:27 77阅读 0赞

bom:browser object model:浏览器对象模型。它的对象结构如图:
在这里插入图片描述
window对象:属性:history和location.
window的方法:
1:prompt,输入。2:alert():弹框 3:confirm:显示一个带有提示信息,确定和取消的对话框。 4:close和open打开和关闭窗口。
history对象的方法:back,forward,go().前进后退。举例一下:
在这里插入图片描述
在这里插入图片描述
首先要用超链接前进后退,其次才能接下来的前进后退。
location对象的属性和方法:
1:document.write(location.host);
2:location.href=“qianjin.html”;
3:location.reload();//刷新本页面
4:location.replace(“qianjin.html”);//相当于页面跳转。

document对象的方法:
1;getElementById. 2:getElementByName. 3:getElementByTagName等等。

js的内置对象:
date对象 上图:
在这里插入图片描述
math对象:
1: ceil()向上入 2:floor()向下舍 3:round四舍五入 4:random
返回0到1之间的随机数。
例题:随机选择颜色:
在这里插入图片描述
window的定时方法:
1:setTimeout(“调用函数”,等待的毫秒数);
2:setInterval(“调用函数”,间隔的毫秒数);
3:clearInterval(调用时间函数的一个变量);
例题:html:
在这里插入图片描述
js:
在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,77人围观)

还没有评论,来说两句吧...

相关阅读