JavaScript -- Window-Blur

本文介绍如何利用JavaScript编写代码,在浏览器中创建新窗口,并实现打开新窗体、关闭窗口、使窗口失去焦点等功能。通过实例演示了如何在新窗口中插入HTML内容,以及如何控制新窗口的行为。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

-----030-Window-Blur.html-----

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 5     <title>标题</title>
 6 </head>
 7 <body>
 8 <script type="text/javascript">
 9     function openNew()
10     {
11         newHtml = "<h4>打开新窗体</h4><center><input type='button', value='关闭'οnclick='window.close();'/></center><center><input type='button', value='失去焦点'οnclick='window.opener=null;window.blur();'/></center>"
12         newWin = window.open("", "新窗口", "height=200, width=200, toolbar=no, menubar=no, status=yes, location=no, top=200, left=200");
13         newWin.document.write(newHtml);
14         t = 0;
15     }
16 
17 </script>
18 <input type="button" value="New" onclick="openNew()"/>
19 </body>
20 </html>

转载于:https://www.cnblogs.com/baijifeilong/p/3728075.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值