js中的Window有很多属性与方法,在这里不一一讲解了,主要讲解下window.opener,下面用祝福语例子讲解下:
window.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>js01_hello</title> <meta name="author" content="Administrator" /> <script type="text/javascript"> </script> </head> <body> <div id="welcome">欢迎进行我们的网站</div> <a href="#" onclick="window.open('test02.html','aaa','width=300,height=300,resizable=0')">test02</a> <br/> <a href="#" onclick="window.open('bless.html','aaa','width=600,height=300')">输入你祝福语</a> <div id="bless"></div> </body> </html>
bless.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>js01_hello</title> <meta name="author" content="Administrator" /> <script type="text/javascript"> function bless() { //获取输入的祝福语 var mb = document.getElementById("mb").value; //获取父类窗口 var p = window.opener; //获取父类窗口中的id为bless的div var pd = p.document.getElementById("bless"); //设置pd的值 pd.innerHTML = mb; //关闭当前窗口 window.close(); } </script> </head> <body> 输入祝福语:<input type="text" size="40" id="mb"/><input type="button" onclick="bless()" value="输入" /> </body> </html>
提醒下:google浏览器好像不支持window.opener,可能是没有了解到,如有知道的请解答下,谢谢
相关推荐
JavaScript的document和window对象详解
javascript表单验证和Window详解.docx
本文较为详细的分析了JavaScript中window.open用法。分享给大家供大家参考。具体如下: 代码如下:[removed] window.open (‘page.html’, ‘newwindow’, ‘height=100, width=400, top=0, left=0, toolbar=no, ...
详解js location.href和window.open的几种用法和区别.docx
window.open参数详解,这是js中新建页面时常用到的属性及方法
Javascript之BOM(window对象)详解_.docx
NULL 博文链接:https://jiangzhenwei6.iteye.com/blog/735102
主要介绍了JavaScript中window.showModalDialog()用法详解,需要的朋友可以参考下
本文详细介绍了JavaScript的window对象。Windows对象是一个顶层对象,而不是另一个对象的属性即浏览器的窗口。
window对象有个name属性,该属性有个特征:即在一个窗口(window)的生命周期内,窗口载入的所有的页面都是共享一个window.name的,每个页面对window.name都有读写的权限,window.name是持久存在一个窗口载入过的所有...
JavaScript中Window.open参数详解 1、最基本的弹出窗口代码 2、经过设置后的弹出窗口 3、用函数控制弹出窗口 4、同时弹出2个窗口 5、主窗口打开文件1.htm,同时弹出小窗口page.html ...
window对象详解 location:定位信息 history:历史 事件总结 常见的事件 所有事件案列 扩展——this使用 案例2-表单校验plus 了解阻止事件 逻辑运算符 列表操作 案例3-隔行换色 dom(文档对象模型)...
内含: 01-native.js 02-utils.js 03-hash.js ...06-window.js 07-document.js 08-function.js 09-number.js 10-string.js 11-event.js 12-class.js 13-class.extras.js mootools1.2中文文档(html版)
一、表单验证form 1、创建一个新的表单: 代码如下: <form id=”id是唯一的,不可重复” name=“可重复”,method=”post/get”,action=”目标或地址,负责处理的服务端,将文本等传输到什么地方”>...
JavaScript的document对象和window对象详解,js经常用得到的知识,了解下。
JavaScript提供了一组以window为核心的对象,实现了对浏览器窗口的访问控制。JavaScript中定义了6种重要的对象: window对象 表示浏览器中打开的窗口; document对象 表示浏览器中加载页面的文档对象; location对象...
【JavaScript】cookies操作详解
JavaScript中BOM和DOM详解 目录 BOM(浏览器对象模型) 1. window 获取浏览器c窗口尺寸 2. screen 获取电脑屏幕大小 3. window 开启关闭窗口 4. 浏览器事件 5. location 6. history 7. navigator 获取浏览器相关...
10.1.2 window对象的使用 10.1.3 创建定时事件 10.1.4 Frame的使用 10.1.5 location对象 10.1.6 history对象 10.1.7 screen对象 10.2 应知应会 练习 第11章 表单及输入...