js:bom,bom,bom
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:
还没有评论,来说两句吧...