学习笔记13

来源:互联网 发布:淘宝ipad版 编辑:程序博客网 时间:2024/04/29 20:33
2017年10月17日
学习笔记与总结

window对象

1.对象的概念
在对象里,某一个对象的属性本身也有可能是一个对象!
凡是以window.开头调用的,都可以省略。

2.Screen对象
屏幕的总宽度:"+ screen.width
屏幕的总高度:"+ screen.height
屏幕的可用宽度:"+ screen.availWidth
(可用高度不包括底部任务栏)
屏幕的可用高度:"+ screen.availHeight
(屏幕旋转角度 逆时针旋转,竖屏显示的时候,旋转角度为90deg.)
(当你的屏幕旋转完毕以后,屏幕的高度,宽度等属性和横屏时对换。)
屏幕的旋转角度"+ screen.orientation.angle

3.Location
完整路径
location.href
基础路径
location.origin
安全协议
location.protocol
主机名称
location.hostname
端口号
location.port
url路径
location.pathname
查询部分
location.search
锚点名称
location.hash

Location方法:
加载新页面
location.assign("");
刷新:不是完全刷新,会从缓存里加载已经存在数据
location.reload();
刷新:完全刷新;彻底刷新当前页面,不会从缓存里获取数据
location.reload(true);
替代页面:用一个新页面替代原先的老页面,跳转到新页面以后,无法返回到新页面
location.replace("");

4.history:
跳转至
location.assign
forward():前进一个页面
history.forward()
back():返回到上一个页面
history.back();
go(2):前进两个页面
history.go(2)
go(2):后退三个页面
history.go(-3)

7.Navigator
console.log(navigator);
产品名称
navigator.appName
版本号
navigator.appVersion
用户代理信息
navigator.userAgent
系统平台
navigator.platform


6.补充:
输入框 参数1:提示信息 参数2:默认值
点击确认按钮:返回输入框的值,若没有值,返回一个空对象
点取消按钮:返回nul
varage= prompt("年龄为:",50);
alert(age);

确认框返回结果:
点击确认按钮:返回true
点击取消按钮:返回false
varresult= confirm("您确定要删除吗?");
alert(result);

confirm("你好!")

关闭当前页面
window.close();

打开页面
open():四个参数(皆为可选项)
1:需要打开的新页面
2:新页面的别称
3:新页面的状态
4:打开的新页面是否替换老页面window.open("http://www.baidu.com","xiaodu","width=200,he ight=300,left=500,top=200",ture);

window.open("http://www.hao123.com","hao123","width=200,height=300",false);


原创粉丝点击