Window对象

Window对象


1、各种弹框

[@more@]

function openWindow(){ //打开普通窗口
var newWin = open("dom.html","newWin",
"height=350,width=350,menubar=1,toolbar=1,
location=1,status=1,scrollbars=1,resizeable=0");
alert("窗体已经打开了!");
newWin.close(); //关闭弹出的窗体
}
function openDialogWindow(){ //打开模式窗口
showModalDialog("dom.html","","height=350px,
width=350px,toolbars=0,menubars=0,scrollbars=0,
resizeable=0,location=0,status=1,titlebars=0");
}

function popAlert(){ //弹出警告框
alert("这是弹出的系统警告框!");
}
function popConfirm(){ //弹出确认框
var ivalue=confirm("这是弹出的系统确认对话框,确定吗?");
return ivalue;
}
function popPrompt(){ //弹出提示框
var ivalue=prompt("这是弹出的系统提示输入框!","这里是默认值");
return ivalue;
}

function closeSelf(){ //窗体关闭自己没有提示 opener=null;
//解决IE7还有提示问题
open("","_self");
close();
}
function ahref(){ //隐藏超链接细节
window.defaultStatus="睡梦儿";
window.status="欢迎来到我的个人空间!";
}
//window的open()方法
function createWin(){
//打开一个新窗口,w为打开新窗口的句柄
var w = window.open();
//向新窗口中写入文本域中的内容
//innerText和textContent是为了IE和Firefox的兼容
w.document.write(
document.getElementById("testarea").innerText||
document.getElementById("testarea").textContent);
}
function openWindow(){ //打开普通窗口
var newWin = open("dom.html","newWin",
"height=350,width=350,menubar=1,toolbar=1,
location=1,status=1,scrollbars=1,resizeable=0");
alert("窗体已经打开了!");
newWin.close(); //关闭弹出的窗体
}
function openDialogWindow(){ //打开模式窗口
showModalDialog("dom.html","","height=350px,
width=350px,toolbars=0,menubars=0,scrollbars=0,
resizeable=0,location=0,status=1,titlebars=0");
}

function popAlert(){ //弹出警告框
alert("这是弹出的系统警告框!");
}
function popConfirm(){ //弹出确认框
var ivalue=confirm("这是弹出的系统确认对话框,确定吗?");
return ivalue;
}
function popPrompt(){ //弹出提示框
var ivalue=prompt("这是弹出的系统提示输入框!","这里是默认值");
return ivalue;
}

function closeSelf(){ //窗体关闭自己没有提示 opener=null;
//解决IE7还有提示问题
open("","_self");
close();
}
function ahref(){ //隐藏超链接细节
window.defaultStatus="睡梦儿";
window.status="欢迎来到我的个人空间!";
}
//window的open()方法
function createWin(){
//打开一个新窗口,w为打开新窗口的句柄
var w = window.open();
//向新窗口中写入文本域中的内容
//innerText和textContent是为了IE和Firefox的兼容
w.document.write(
document.getElementById("testarea").innerText||
document.getElementById("testarea").textContent);
}


2、window对象的属性


//列举window对象的所有属性
pf("-------------window对象的所有属性------------");
for(k in window){
pf(k);
}
document 当前文件的信息
location 当前URL的信息
name 窗口名称
status 状态栏的临时信息
defaultStatus 状态栏默认信息
history 该窗口最近查阅过的网页
closed 判断窗口是否关闭,返回布尔值
opner open 方法打开的窗口的源窗口
outerHeight 窗口边界的垂直尺寸,px
outerWidth 窗口边界的水平尺寸,px
pageXOffset 网页x-position的位置
pageYOffset 网页y-position的位置
innerHeight 窗口内容区的垂直尺寸,px
innerWidth 窗口内容区的水平尺寸,px
screenX 窗口左边界的X坐标
screenY 窗口上边界的Y坐标
self 当前窗口
top 最上方的窗口
parent 当前窗口或框架的框架组
frames 对应到窗口中的框架
length 框架的个数
locationbar 浏览器地址栏
menubar 浏览器菜单栏
scrollbars 浏览器滚动条
statusbar 浏览器状态栏
toolbar 浏览器工具栏
offscreenBuffering 是否更新窗口外的区域

3、window对象的方法


forward() 加载历史记录中的下一网页
open(URL,窗口名称[,窗口规格]) 打开窗口
focus() 焦点移到该窗口
blur() 窗口转成背景
stop() 停止加载网页
close()
enableExternalCapture() 允许有框架的窗口获取事件
disableExternalCapture() 关闭enableExternalCapture()
captureEvents(事件类型) 捕捉窗口的特定事件
setResizable(true|false) 是否允许调整窗口大小
resizeBy(水平点数,垂直点数) 相对调整窗口大小
resizeTo(宽度,高度) 绝对调整窗口大小
scroll(x坐标,y坐标) 绝对滚动窗口
scrollBy(水平点数,垂直点数) 相对滚动窗口
scrollTo(x坐标,y坐标) 绝对滚动窗口

setInterval(表达式,毫秒) 循环执行某个动作
setTimeout(表达式,毫秒) 延时执行某个动作
clearInterval(定时器对象) 清除循环执行的某个动作
clearTimeout(定时器对象) 清除延时执行的动作
home() 进入浏览器设置的主页
find([字串[,caseSensitivr,backward]]) 查找窗口中特定的字串
print() 窗口打印
setHotKeys(true|false) 激活或关闭组合键
setZOptions() 设置窗口重叠时的堆栈顺序

4、窗口的事件处理程序


onBlur onDragDrop onError onFocus onLoad onMove onResize onUnload

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ppjava2009/archive/2010/02/24/5323205.aspx

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23493047/viewspace-1033140/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23493047/viewspace-1033140/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值