<html>
<head>
<meta charset="utf-8">
<title>window对象方法</title>
</head> <body>
<div style="text-align:center;text-">Window对象的方法</div>
<div id="divId"></div>
<input type="button" value="取消间歇定时器" onclick="clearInter()"/> <input type="button" value="打开新窗口" onclick="moveWin()"/> <input type="button" value="改变浏览器窗口大小" onclick="resizeWin()"/> <input type="button" value="打开新窗口" onclick="openWin()"/> <input type="button" value="新窗口自动关闭" onclick="testWin()"/> <input type="button" value="模态对话框自动关闭" onclick="testDialog()"/> <script language="javascript">
//01alert
//window.alert("alert!!!"); //02 确认对话框
//window.confirm("???"); //03 输入信息对话框
//window.prompt("提示信息","默认值"); //04 close() 关闭当前浏览器窗口
//window.close(); //05 导航到指定URL资源
//window.navigate("http://www.baidu.com");
//window.navigate('http://www.baidu.com'); //06 间歇定时器
var int=setInterval("inner()",2000);
var s="";
function inner(){
var div=document.getElementById("divId");
s+="Hello World!!!<br/>";
div.innerHTML=s;
} //07 定时计时器
//setTimeout('inner()',5000); //08 取消间歇定时器
//即使得当前间歇计时器停止执行,执行过的内容仍在
function clearInter(){
window.clearInterval(int);
} //09 取消定时计时器 参数为计时器变量
//window.clearTimeout(int); //10 移动浏览器窗口到指定的屏幕位置
//在IE浏览器中有效
function moveWin(){
myWin=window.open('http://www.baidu.com','_blank','width=200,height=100');
myWin.document.write("新窗口!!!");
myWin.moveTo(0,0);
myWin.focus();
} //11 改变浏览器窗口大小
function resizeWin(){
window.resizeTo(400,400);
} //12 打开新窗口
function openWin(){
window.open('http://www.baidu.com','_blank','top=10,left=0,toolbar=no,width=100,height=100');
} //13 模态对话框窗口 必须关闭模态对话框才能在原始网页窗口进行操作
//window.showModalDialog('http://www.baidu.com','zhangsan'); //14 非模态对话框窗口 不用关闭模态对话框也能在原始网页窗口进行操作
//window.showModelessDialog('http://www.baidu.com','zhangsan'); //测试打开一个小窗口 5秒后自动关闭
function testWin(){
myWin=window.open("./test02.html","_blank","width=100,height=100");
myWin.moveTo(0,0);
setTimeout("myWin.close()",5000);
} function testDialog(){
var myDialog=window.showModalDialog();
setTimeout('myDialog.close()',5000);
//
}
</script>
</body>
</html>
 <html>
<head>
<meta charset="utf-8">
<title>window对象方法</title>
</head> <body>
<div style="text-align:center;text-">Window对象的方法</div>
<div id="divId"></div>
<input type="button" value="取消间歇定时器" onclick="clearInter()"/> <input type="button" value="打开新窗口" onclick="moveWin()"/> <input type="button" value="改变浏览器窗口大小" onclick="resizeWin()"/> <input type="button" value="打开新窗口" onclick="openWin()"/> <input type="button" value="新窗口自动关闭" onclick="testWin()"/> <input type="button" value="模态对话框自动关闭" onclick="testDialog()"/> <script language="javascript">
//01alert
//window.alert("alert!!!"); //02 确认对话框
//window.confirm("???"); //03 输入信息对话框
//window.prompt("提示信息","默认值"); //04 close() 关闭当前浏览器窗口
//window.close(); //05 导航到指定URL资源
//window.navigate("http://www.baidu.com");
//window.navigate('http://www.baidu.com'); //06 间歇定时器
var int=setInterval("inner()",2000);
var s="";
function inner(){
var div=document.getElementById("divId");
s+="Hello World!!!<br/>";
div.innerHTML=s;
} //07 定时计时器
//setTimeout('inner()',5000); //08 取消间歇定时器
//即使得当前间歇计时器停止执行,执行过的内容仍在
function clearInter(){
window.clearInterval(int);
} //09 取消定时计时器 参数为计时器变量
//window.clearTimeout(int); //10 移动浏览器窗口到指定的屏幕位置
//在IE浏览器中有效
function moveWin(){
myWin=window.open('http://www.baidu.com','_blank','width=200,height=100');
myWin.document.write("新窗口!!!");
myWin.moveTo(0,0);
myWin.focus();
} //11 改变浏览器窗口大小
function resizeWin(){
window.resizeTo(400,400);
} //12 打开新窗口
function openWin(){
window.open('http://www.baidu.com','_blank','top=10,left=0,toolbar=no,width=100,height=100');
} //13 模态对话框窗口 必须关闭模态对话框才能在原始网页窗口进行操作
//window.showModalDialog('http://www.baidu.com','zhangsan'); //14 非模态对话框窗口 不用关闭模态对话框也能在原始网页窗口进行操作
//window.showModelessDialog('http://www.baidu.com','zhangsan'); //测试打开一个小窗口 5秒后自动关闭
function testWin(){
myWin=window.open("./test02.html","_blank","width=100,height=100");
myWin.moveTo(0,0);
setTimeout("myWin.close()",5000);
} function testDialog(){
var myDialog=window.showModalDialog();
setTimeout('myDialog.close()',5000);
//
}
</script>
</body>
</html>

最新文章

  1. jQuery静态方法isFunction,isArray,isWindow,isNumeric使用和源码分析
  2. mac os 下的sublime --- 快捷键
  3. apache2.4 windows764 python cgi
  4. iOS GCD NSOperation NSThread等多线程各种举例详解(拷贝)
  5. 一个奇怪的MySQL错误返回
  6. 客户端HTTP断点续传的原理
  7. Apache-Commons包作用说明
  8. 把excel数据生成sql insert语句
  9. iPad中控制器view的width和height
  10. Bluetooth in Android 4.2 and 4.3(一):综述
  11. OD: Exploit Me - Inject Instruction
  12. 修改linux文件权限命令:chmod 【转载】
  13. [DP优化方法之虚树]
  14. Mybatis基础学习(二)&mdash;开发Dao方式
  15. java自动化测试-http请求结合抓包工具实际应用
  16. Pyhton爬虫实战 - 抓取BOSS直聘职位描述 和 数据清洗
  17. JAVA数组练习
  18. centos 配置mysql
  19. WEB H5 JS QRCode二维码快速自动生成
  20. Django-工程搭建

热门文章

  1. 【Eclipse】eclipse安装JAVA反编译插件
  2. msp430入门编程05
  3. SOJ 2785_Binary Partitions
  4. UVA 10564_ Paths through the Hourglass
  5. [bzoj1934/2768][Shoi2007]Vote 善意的投票_最小割
  6. [bzoj1430]小猴打架_prufer序列
  7. Redis的集群方案之Sentinel(哨兵模式)(待实践)
  8. Java:删除某文件夹下的所有文件
  9. vs2013生成lib
  10. SQL Server 海量数据查询代码优化以及建议