不同的页面之间是如何传递值的? test.html?name=fason可以用location.search来截取window.open打开的可以用window.opener获得原打开的窗口 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这两个页之间是什么关系呢,父与子的关系?可以这样子传值.parent.htm<input type=text name=maintext><input type=button onclick="window.open('son.htm')" value="Open">son.htm<input type=text name=sontext><input type=button onclick="top.opener.document.all.maintext.value=document.all.sontext.value" value="Post">可以用Cookie解决demo.htm<form action="tz1.htm" method="get"><select name="type" onchange="setCookie('baobao',this.options[this.options.selectedIndex].innerText+':'+this.options[this.options.selectedIndex].value)"> <option value="1">协会介绍</option> <option value="2">技术研发室</option></select><input type="text" name="fa"><input type="submit" class="button"></form ><script>function setCookie(name,value){ var Days = 30; var exp = new Date(); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();}</script>tz1.htm<script>function getCookie(name){ var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr !=null) return unescape(arr[2]); return null;}document.write(getCookie("baobao"));</script> 还有,就是像Fason说的那样通过url来传值demo.htm<a href="in.htm?action=y">Test</a>in.htm<script language="javascript" >/* *--------------- Request.htm ----------------- * Request[key] * 功能:实现ASP的取得URL字符串,Request("AAA") * 参数:key,字符串. * 实例:alert(Request["AAA"]) * author:wanghr100(灰豆宝宝.net) * update:2004-6-11 10:30 *--------------- Request.htm ----------------- */var url=location.search;var Request = new Object();if(url.indexOf("?")!=-1){ var str = url.substr(1) //去掉?号 strs = str.split("&"); for(var i=0;i<strs.length;i++) { Request[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); }}alert(Request["action"])</script> get post cookie session等都可以 Sorry...son.htm<input type=text name=sontext><input type=button onclick="top.opener.document.all.maintext.value=document.all.sontext.value" value="Post">->son.htm<input type=text name=sontext><input type=button onclick="window.opener.document.all.maintext.value=document.all.sontext.value" value="Post"> window.openerwindow.topwindow.parent jquery 问题求助 请教飘浮层或者图片的代码使其在当前屏幕随机飘浮,但不受滚动条控制 (function(){})()是什么意思? 求助:如何调用上级对象的元素 高手们求救!!UltraWebTree树型控件复选框的几个问题 急急!!! 如何让图片显示出来 给绑有编辑控件的文本域赋值问题,高人进???? 高分求一列表框脚本,快快快!!!! 请问能否将一个字符串变量(按js语法书写),做为脚本来执行,谢谢! javascript如何获得客户端的IP地址,浏览器类型及版本号和操作系统类型(版本)? 再请教一个基本的问题:这是用的什么脚本? 怎么才能知道客户端office版本?
<input type=button onclick="window.open('son.htm')" value="Open">son.htm
<input type=text name=sontext>
<input type=button onclick="top.opener.document.all.maintext.value=document.all.sontext.value" value="Post">
可以用Cookie解决demo.htm<form action="tz1.htm" method="get">
<select name="type" onchange="setCookie('baobao',this.options[this.options.selectedIndex].innerText+':'+this.options[this.options.selectedIndex].value)">
<option value="1">协会介绍</option>
<option value="2">技术研发室</option>
</select>
<input type="text" name="fa">
<input type="submit" class="button">
</form >
<script>
function setCookie(name,value)
{
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
</script>tz1.htm<script>
function getCookie(name)
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr !=null) return unescape(arr[2]); return null;
}
document.write(getCookie("baobao"));
</script>
/*
*--------------- Request.htm -----------------
* Request[key]
* 功能:实现ASP的取得URL字符串,Request("AAA")
* 参数:key,字符串.
* 实例:alert(Request["AAA"])
* author:wanghr100(灰豆宝宝.net)
* update:2004-6-11 10:30
*--------------- Request.htm -----------------
*/
var url=location.search;
var Request = new Object();
if(url.indexOf("?")!=-1)
{
var str = url.substr(1) //去掉?号
strs = str.split("&");
for(var i=0;i<strs.length;i++)
{
Request[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
}
}
alert(Request["action"])
</script>
等都可以
<input type=text name=sontext>
<input type=button onclick="top.opener.document.all.maintext.value=document.all.sontext.value" value="Post">->son.htm
<input type=text name=sontext>
<input type=button onclick="window.opener.document.all.maintext.value=document.all.sontext.value" value="Post">
window.top
window.parent