java window closed,马克java社区,马克吐温社区,javascript当中open&close的用法,javascript,Window属性,open&close的用法,opene...

javascript当中open&close的用法

例 1.4.1(open&closeIEFF.html)

cla.html

请选择班级

0708

0709

0802

js_5_openclose.html

您的浏览器不支持video标签

例 1.4.2(OpenCloseWriteDocumentIEFF.html)

var n = 0;

var win = null;

function show(msg)

{

/*Window.closed (Property)

A property value that is true if the window is closed. qixy: but even though win is closed, win.closed=true, but

win does not become null, because win is this window's property, it as a property is not destroyed.

*/

msg=msg+"win is"+win;

if ((win == null) || (win.closed))

{

msg=msg+"inside if (win == null) || (win.closed)";

//               alert("win is"+win);

/*aNewWindow = myWindow.open(aURL, aName, aFeatureList)

aFeatureList A list of attributes for the new window

aName The name of a new or existing target window

*/

win =window.open("","consoleqixy","width=400,height=250,resizable");

}

win.focus();

/*马克-to-win:the following two statements means: clear the document. because clear is deprecated.if you remove the following two statements, win.document still has past content. so new content appends past content. so contens becomes more and more.qixy: if window is closed, its document also is cleared.*/

//            win.document.clear();

win.document.close();

win.document.open();

win.document.writeln(msg);

/*马克-to-win:the following two statements can not be used to write content, because later on the whole page content only will have the following two statement's content, so function body is also missing. to solve the problem refer to OpenCloseWriteDocument1.html, the conclusion is that when we want to write something, we open another new window to write in.*/

//document.writeln('');

//   document.writeln("this "+msg);

}

js_5_openclose.html

您的浏览器不支持video标签

例 1.4.3(OpenCloseWriteDocument2IEFF.html)

var n = 0;

var win = null;

function show(msg)

{

/*Window.closed (Property)

A property value that is true if the window is closed.

*/

if ((win == null) || (win.closed))

{

win =window.open("","consoleqixy","width=400,height=250,resizable");

//将该文档打开成一个普通文档, 而不是一个text/html文档

win.document.open("text/plain");

win.x=9;

}

win.focus(  );

win.document.writeln(msg+(++win.x));

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值