BOM:浏览器对象
2024-10-06 17:59:30
1、window是javascript的顶级对象
window有很多内置方法 如 alert open 自定义函数
2、window是bom的顶级对象,通常情况下,可以省略
window.alert()
alert()
成员变量也是windew的一个属性
var aaa=;
alert(aaa);
alert(window.aaa)
alert(aaa=== window.aaa)
自定义函数也是window的一个方法
function fn(){
console.log();
console.log();
}
3、关闭打开一个新窗口
window.open()打开也窗口
var a1=document.getElementsByTagName("a")[];
var a2=document.getElementsByTagName("a")[];
a1.onclick=function(){
window.open("http://www.jd.com","_black")
};
window.close()关闭窗口
a2.onclick = function () {
window.close();
}
windoe.location 相当于浏览器的地址栏
location对象属性
.location.href ="跳转到的新网址" 页面跳转
var div=document.getElementsByTagName("div")[];
div.onclick=function(){
location.href="http://www.baidu.com"
}
userAgent属性可以获取用户端的一些信息
//系统,浏览器
console.log(navigator.userAgent) //浏览器支持的系统
console.log(navigator.platform)
history对象 历史记录管理
history.go(-1) heistory.bock()后退
var but=document.getElementsByTagName("button")[];
but.onclick=function () {
history.go(-)
}
history.go(1) 前进
最新文章
- UIAlertViewController的使用
- selenium隔离环境安装、以及示例
- eclipse/intellij Idea集成jetty
- JS简单加密
- Android Programming: Pushing the Limits -- Chapter 6: Services and Background Tasks
- 未能找到类型或命名空间名称“Coco”(是否缺少 using 指令或程序集引用)
- ZooKeeper启动过程2:FastLeaderElection
- 关于Viual Studio 改变编辑器背景背景及背景图片(转)
- 网上图书商城项目学习笔记-012BOOK模块查询2
- Express异步进化史
- 文本编辑工具vim
- 初探Google Guava
- leetcode — jump-game-ii
- ux.form.field.Month 只能选年、月的时间扩展
- RAD Studio August 2018 Roadmap
- C#语言经典例题
- [廖雪峰] Git 分支管理(3):分支管理策略
- 如何在Java 环境下使用 HTTP 协议收发 MQ 消息
- asp.net文件压缩,下载,物理路径,相对路径,删除文件
- Coredata — 入门使用