用window.open方法打开新窗口显示提示信息
2006-12-05 18:13
781 查看
有时候我们需要打开一个新窗口用来显示提示信息
这个自然会想到用window.open()方法
但新窗体的内容并不是固定的
如果我们建立一个 tip.html 的静态页面,专门用来让window.open打开,打开之后再用js设置窗体的内容
这样做也能满足要求,但是有没有更好的方法呢?
下面的方法可以不用建一个专门的静态页面,而是每次都是打开一个临时窗口,窗体的内容也是动态构造的
请看代码:
<input type=button value=open onclick="openWindow=window.open();
openWindow.document.writeln('<html>');
openWindow.document.writeln('<TITLE>Open Test</TITLE>');
openWindow.document.writeln('<BODY>');
openWindow.document.writeln('<center>');
openWindow.document.writeln('Hello! New window opened!');
openWindow.document.writeln('<br><br>');
openWindow.document.writeln('<input type=button value=close onclick=window.close()>');
openWindow.document.writeln('</center>');
openWindow.document.writeln('</BODY>');
openWindow.document.writeln('</HTML>');
openWindow.document.close(); " >
function runEx() {
openWindow=window.open();
openWindow.document.writeln("');");
openWindow.document.writeln("openWindow.document.writeln('Open Test');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('Hello! New window opened!');");
openWindow.document.writeln("openWindow.document.writeln('
');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.close();\" >");
openWindow.document.close();
}
这个自然会想到用window.open()方法
但新窗体的内容并不是固定的
如果我们建立一个 tip.html 的静态页面,专门用来让window.open打开,打开之后再用js设置窗体的内容
这样做也能满足要求,但是有没有更好的方法呢?
下面的方法可以不用建一个专门的静态页面,而是每次都是打开一个临时窗口,窗体的内容也是动态构造的
请看代码:
<input type=button value=open onclick="openWindow=window.open();
openWindow.document.writeln('<html>');
openWindow.document.writeln('<TITLE>Open Test</TITLE>');
openWindow.document.writeln('<BODY>');
openWindow.document.writeln('<center>');
openWindow.document.writeln('Hello! New window opened!');
openWindow.document.writeln('<br><br>');
openWindow.document.writeln('<input type=button value=close onclick=window.close()>');
openWindow.document.writeln('</center>');
openWindow.document.writeln('</BODY>');
openWindow.document.writeln('</HTML>');
openWindow.document.close(); " >
function runEx() {
openWindow=window.open();
openWindow.document.writeln("');");
openWindow.document.writeln("openWindow.document.writeln('Open Test');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('Hello! New window opened!');");
openWindow.document.writeln("openWindow.document.writeln('
');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.writeln('');");
openWindow.document.writeln("openWindow.document.close();\" >");
openWindow.document.close();
}
相关文章推荐
- 用window.open方法打开新窗口显示提示信息
- ajax打开新窗口window.open()被拦截的解决方法
- 打开新窗口的window.open使用方法以及最大化等问题解决方法汇总
- javascript window.open打开新窗口后无法再次打开该窗口问题的解决方法
- 打开新窗口的window.open使用方法以及最大化等问题解决方法汇总
- window.open()方法打开的子窗口怎样调用父窗口的方法呢?
- 关于window.open()方法 返回的的打开的新窗口的对象
- window.open打开新窗口被浏览器拦截的处理方法
- 如何屏蔽window.open打开窗口标题栏的url显示
- window.open 打开新窗口无提示自动关闭父窗口
- javascript window.open打开新窗口后无法再次打开该窗口问题的解决方法
- window.open打开一个新窗口/子窗口中调用父窗口的方法
- window.open打开窗口被拦截的快速解决方法
- 打开新窗口及信息提示框(C#方法)
- window.open打开一个新窗口/子窗口中调用父窗口的方法
- 打开新窗口的window.open使用方法以及最大化等问题解决方法汇总
- JS窗口问题处理:使弹出窗口保持前端显示的几种方法,及window窗体对象open()和showModalDialog()用法
- jQuery实现鼠标悬停显示提示信息窗口的方法
- 子窗口在用window.open()方法打开后,如何关闭后刷新父窗口
- ASP.NET弹出新窗口的方法【显示提示信息】