求一javascript中跨页传值的例子 需求是这样的a.html是通过b.html页面打开a.html和b.html各有一个textbox,txta和txtb点击b.html里的按钮将txtfb的值传入a.html的txta,并关闭 b.html 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考http://topic.csdn.net/u/20090706/15/e156b3d4-6732-4a6f-8c81-110fc12759cd.html caller.html <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Caller</title> <script type="text/javascript"> function openPage(elem, page){ var loading = document.createElement('span'); loading.innerHTML = 'loading'; var arg = { window: window, input: document.getElementById('input') }; window.showModalDialog(page, arg, 'titlebar:no;status:no;dialogWidth:300px;dialogHeight:300px'); } </script> </head> <body> <a hre="#" onclick="openPage(this, 'input.html');" style="cursor:hand">open</a> <textarea id="input"></textarea> </body></html>input.html <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> var arg = window.dialogArguments; window.onload =function(){ var done = document.getElementById('done'), input = document.getElementById('input'); done.onclick = function(){ arg.input.value = input.value; window.close(); } } </script> </head> <body> <textarea id="input"></textarea> <input type="button" id="done" value="done" /> </body></html> 老子通过url传值,将值传给儿子,然后关闭自己~~或者,儿子被打开之后,去获取老子页面上的那个控件值,通过windows.opener.document....思路就这样~ 字符串拼接问题 JQuery插件wBox,弹出一个窗口,怎么回调父窗口的方法 如何根据自定义属性,取元素? 1:DOCTYPE对JavaScript有什么影响 2:YUI优化问题 网页程序 如何实现用Ajax从服务端获取一图片流,并在客户端显示出来? 普通按钮传递参数问题 如何产生8位数的随机数 怎样将已有的javascript文件放在一个button中 java script 有没有饼图的对象,显示百分比,有例子最好 好用的web打印控件都有哪些? 函数劫持,代码有什么问题?
http://topic.csdn.net/u/20090706/15/e156b3d4-6732-4a6f-8c81-110fc12759cd.html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Caller</title>
<script type="text/javascript">
function openPage(elem, page){
var loading = document.createElement('span');
loading.innerHTML = 'loading';
var arg = {
window: window,
input: document.getElementById('input')
};
window.showModalDialog(page, arg, 'titlebar:no;status:no;dialogWidth:300px;dialogHeight:300px');
}
</script>
</head>
<body>
<a hre="#" onclick="openPage(this, 'input.html');" style="cursor:hand">open</a>
<textarea id="input"></textarea>
</body>
</html>input.html <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
var arg = window.dialogArguments;
window.onload =function(){
var done = document.getElementById('done'),
input = document.getElementById('input');
done.onclick = function(){
arg.input.value = input.value;
window.close();
}
}
</script>
</head>
<body>
<textarea id="input"></textarea>
<input type="button" id="done" value="done" />
</body>
</html>
或者,儿子被打开之后,去获取老子页面上的那个控件值,通过windows.opener.document....
思路就这样~