子页面怎么提交到父页啊,不是仅完成赋值给父页,而是要让父页request子页便于完成查询结果的显示

hateyoucode 2008-04-17 11:23:29
RT,我A页是记录的显示页,有个查询按扭,点查询就window.open(B),B可以选择很多条件,然后查询!A页就RequestB提交过来的参数,并且完成查询,显示结果!不是仅opener.form1.myname.value='',这样不能完成查询,只完成了赋值!我想要得到完成子页提交给父页的功能!大家帮帮!
...全文
174 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
myvicy 2008-04-17
  • 打赏
  • 举报
回复
这样可以更简单一些。

在a.asp页面加入:
<script>
name="windowA"//设置窗口的名称
</script>

直接将B页的form的action设置为A页,并且将A的form的target设置为windowA,在submit加代码即可。

<form action="a.asp" target="windowA" onsubmit="opener=null;window.close()">
<input name="test" type="text" />
<input name="" type="submit" />
</form>

测试通过。提交后a.asp的表单值在后台获取,记录集仍正常显示。
  • 打赏
  • 举报
回复
var xmvalue//这个的值怎么获取我就不说了,就是你得条件,比如xmvalue="a=1&b=2&c=3"类似这样
关于这个,就看你怎么提交形成xmvalue="a=1&b=2&c=3"这样的形式了
  • 打赏
  • 举报
回复
我就说在B面选择条件时就完成提交查询吧

我假设A.asp面<div id="sug"></div>

B.ASP

<script language="javascript">
<!--
var xmlHttp = false;
function ajaxcreate(){
try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
if(!xmlHttp){alert('Create Xmlhttp Fail ');return false;}
}


function sugguest(){
ajaxcreate();
var xmvalue//这个的值怎么获取我就不说了,就是你得条件,比如xmvalue="a=1&b=2&c=3"类似这样
var url="C.ASP?"+xmvalue);
if (xmvalue== null || xmvalue.length>20 || xmvalue == "") return false;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.send(xmvalue);
xmlHttp.onreadystatechange=returnstate;
}


function returnstate(){
if(xmlHttp.readyState != 4 ){
opener.document.getElementById("sug").innerHTML="plase wait....";
}
if(xmlHttp.readyState == 4 ){
opener.document.getElementById("sug").innerHTML=xmlHttp.responseText;
}
}
</script>


C.ASP

这里我假设你传递过来的xmvalue="a=1&b=2&c=3"


a=Request.QueryString("a")
b=Request.QueryString("b")
c=Request.QueryString("c")
set rs = server.CreateObject ("adodb.recordset")
sql="select * from news where a='"&&"' and b='"&b&"' and c='"&c&"' order by id desc"
rs.open sql,conn,1,1
response.Write("<div id=show >")
if not rs.bof then
do while not rs.eof
response.Write("<li onMouseOver=""this.style.background='#d7ebff'"" onMouseOut=""this.style.background='#ffffff'"" onclick=""javascript:fillin(this.innerHTML);"">"&rs("title")&"</li>")
rs.movenext
loop
end if
response.Write("</div>")
hateyoucode 2008-04-17
  • 打赏
  • 举报
回复
A页只完成显示数据,没有查询条件的输入口,条件的输入口都在B页!
hateyoucode 2008-04-17
  • 打赏
  • 举报
回复
B页完成提交!其实是提交给A页查询
  • 打赏
  • 举报
回复
你是想在A面提交查询,还是在B面选择条件完毕就提交查询?
这个可是不同的做法的
说清楚
beyondamane 2008-04-17
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 myvicy 的回复:]
这样可以更简单一些。

在a.asp页面加入:
<script>
name="windowA"//设置窗口的名称
</script>

直接将B页的form的action设置为A页,并且将A的form的target设置为windowA,在submit加代码即可。

<form action="a.asp" target="windowA" onsubmit="opener=null;window.close()">
<input name="test" type="text" />
<input name="" type="submit" />
</form>

测试通过。提交后a.asp的表单值在后台获取…
[/Quote]

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧