JavaScript学习记录总结(十)——几个重要的BOM对象
一、弹出框
<script type="text/javascript">
window.onload=function(){
window.alert("msg alert");
var msg =window.prompt("prompt", "hello"); //msg hello 或者null
alert(msg);
var msg1=window.confirm("hahah"); //msg1 true false;
alert(msg1);
//alert prompt confirm
};
</script>
二、open
<script type="text/javascript">
function openW(){
//定义自己的外观
window.open("window2.html","mypage","width=500,height=500,titlebar=yes,resizable=yes",true);
}
</script>
</head>
<body>
<input type="button" onclick="openW()" value="打开新窗体"/>
</body>
三、window.setInterval
<script type="text/javascript">
//window.self属性 代表当前的窗体
//window.setInterval("函数名()",时间戳); 每隔时间戳 执行一次函数
var id=window.self.setInterval("clock()",1);
function clock(){
var t=new Date();
document.getElementById("clock").value=t;
}
function cls(){
window.self.clearInterval(id);
}
</script>
</head>
<body>
<!-- 输入框 -->
<input type="text" id="clock" size="35" />
<input type="button" value="清空操作" onclick="cls()"/>
</body>
四、window.setTimeout
<script type="text/javascript">
//window.self属性 代表当前的窗体
//window.setTimeout("函数名()",时间戳); 隔时间戳后 执行一次函数
var id=window.self.setTimeout("clock()",3000);
function clock(){
var t=new Date();
document.getElementById("clock").value=t;
//id=window.self.setTimeout("clock()",3000);
}
function cls(){
window.clearTimeout(id);
}
//面试题
</script>
</head>
<body>
<!-- 输入框 -->
<input type="text" id="clock" size="35" />
<input type="button" value="清空操作" onclick="cls()"/>
</body>
五、Location
<script type="text/javascript">
function goUrl()
{
alert(window.location.host);
alert(window.location.hostname);
alert(window.location.port);
alert(window.location.protocol);
alert(window.location.search);
window.location.href="http://www.baidu.com";
}
</script>
</head>
<body>
<input type="button" value="发送新的请求" onclick="goUrl()"/>
</body>
六、History
1.html
<body>
<a href="2.html">进入2.html</a>
<a href="./l.html?name=chj">进入l.html</a>
</body>
2.html
<body>
<!-- <a href="javascript:history.back()">返回1.html</a> -->
<a href="javascript:history.go(-1)">返回1.html</a>
<a href="3.html">进入3.html</a>
<!-- <a href="javascript:history.forward()">前进</a> -->
<a href="javascript:history.go(1)">前进</a>
</body>
3.html
<body>
This is my HTML page. <br>
<!-- <a href="javascript:history.back()">返回2.html</a> -->
<a href="javascript:history.go(-1)">返回12.html</a>
</body>
JavaScript学习记录总结(十)——几个重要的BOM对象的更多相关文章
- JavaScript学习记录四
title: JavaScript学习记录四 toc: true date: 2018-09-16 20:31:22 --<JavaScript高级程序设计(第2版)>学习笔记 要多查阅M ...
- JavaScript学习记录三
title: JavaScript学习记录三 toc: true date: 2018-09-14 23:51:22 --<JavaScript高级程序设计(第2版)>学习笔记 要多查阅M ...
- JavaScript学习记录二
title: JavaScript学习记录二 toc: true date: 2018-09-13 10:14:53 --<JavaScript高级程序设计(第2版)>学习笔记 要多查阅M ...
- JavaScript学习记录一
title: JavaScript学习记录一 toc: true date: 2018-09-11 18:26:52 --<JavaScript高级程序设计(第2版)>学习笔记 要多查阅M ...
- JavaScript学习笔记(四十四) 装饰器
装饰器模式(Decorator) 在装饰器模式中,可以在运行时给一个对象动态的添加额外的功能.当和静态类打交道的时候(static classes),这可能是一个挑战.但在JavaScript中,对象 ...
- JavaScript -- 时光流逝(十二):DOM -- Element 对象
JavaScript -- 知识点回顾篇(十二):DOM -- Element 对象 (1) element.accessKey: 设置或返回accesskey一个元素,使用 Alt + 指定快捷键 ...
- 诶西,JavaScript学习记录。。。。。。
由于大学课程缘故,老师巨爱叫人问问题,还记分呢,随便记录一下Js的学习情况,以后复习什么的也比较方便吧...... 开始咯,就按照C语言学习那样的方法来吧! ===================== ...
- Javascript学习记录——原生JS实现旋转木马特效
昨天学习到了JS特效部分,然后老师讲了旋转木马特效的实现,如上图.不过只是讲了通过点击箭头实现图片的切换,对于点击图片本身以及二者联动却是没有讲解. 本着一颗追求完美的心,今天花费了一个中午终于将整个 ...
- JavaScript学习记录总结(七)——dom对象应用之用户简单管理
<!DOCTYPE html><html><head><title>users.html</title> <meta name=&qu ...
随机推荐
- IT公司100题-15-求二元查找树的镜像
问题描述: 输入一颗二元查找树,将该树转换为它的镜像树,即对每一个节点,互换左右子树. 例如输入: 6/ \4 12/ \ / \2 5 8 16 输出: 6/ ...
- 关于Integer缓冲
默认的时候,-128--127范围内的数会被缓冲 但是jvm启动的时候可以修改启动参数-Djava.lang.Integer.IntegerCache.high=2000 来修改上限,但是下限是不可以 ...
- centos ssh 无密码登录
在linux系统中,ssh是远程登录的默认工具,因为该工具的协议使用了RSA/DSA的加密算法.该工具做linux系统的远程管理是非常安全的.telnet,因为其不安全性,在linux系统中被搁置使用 ...
- droidbox官网
droidbox官网,droidbox已经移植到github上了 https://github.com/pjlantz/droidbox
- dfs介绍
深度优先搜索(DFS) [算法入门] 郭志伟@SYSU:raphealguo(at)qq.com 2012/05/12 1.前言 深度优先搜索(缩写DFS)有点类似广度优先搜索,也是对一个连通图进行遍 ...
- APP推广入门之AppStore数据分析
AppStore中有很多数据,但对于一个App推广者而言,最需要关注的无非这么几个,即下载量.评论.权重.榜单排名.搜索排名以及热词搜索等.至于这些数据具体代表着什么,下面就先由下载量开始,来简单介绍 ...
- GETorPOST方式保存和获取图片信息
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.N ...
- Inno Setup脚本语法大全
Inno Setup脚本语法大全 ResourceShare Bruce 11个月前 (10-28) 6136浏览 0评论 Inno Setup 是什么?Inno Setup 是一个免费的 Win ...
- magento转移服务器和magento建立多站点总结
magento转移服务器和magento建立多站点总结第一. 我们首先要做的就是把服务器上的magento转移到本地上来.详细步骤:1. 直接用magento的备份系统把网上数据库备份.如图:2. 数 ...
- iOS-NSThread使用
NSThread: 优点:NSThread 比其他两个轻量级(Cocoa NSOperation.GCD) 缺点:需要自己管理线程的生命周期,线程同步.线程同步对数据的加锁会有一定的系统开销 Coco ...