页面传值无刷新问题

chinank 2008-04-13 11:49:34
我想实现如下功能:
在A页面点击textbox,弹出B页面,在B页面会有好多行产品记录,点击某一条记录后,B页面关闭,A页面的textbox被负值产品名称,同时A页面有个没有内容的select(产品规格)也被从数据库中增加好几个选项。注:1个产品会有好几个规格。

==============================
现只是不知道js语法怎么实现,求代码或更好的解决办法。谢!
...全文
65 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
chinank 2008-04-14
  • 打赏
  • 举报
回复
已经结决,呵呵,谢谢。
chinank 2008-04-14
  • 打赏
  • 举报
回复
可不可以把添加select选项的代码放到zi1.asp中去执行?
  • 打赏
  • 举报
回复
自己把
<%
for i=0 to 5
%>
info[ <%=i%>] = new Array(" <%=i%>"," <%=j%>"," <%=i%>");
<%j=j+1
next
%>
j= <%=j%>;
这部分换成数据库的应该就可以了

function changelocation1(locationid,j)
这个函数如果也可以写成function changelocation1(locationid)
那么调用的时候就只用window.opener.changelocation1(1)
这样就可以了
  • 打赏
  • 举报
回复
我写了个
B面:
<input name="zi1" type="text"> zi1 <br />
<br />
<input type="button" value="关闭窗口" onclick="xs();">
<script language="javascript">

function xs(){
window.opener.znum(document.getElementById("zi1").value,0);
window.opener.changelocation1(1,5);
window.close();
}
</script>

A面:
<script language = "javascript">
var j;
j=0;
info = new Array();

<%
for i=0 to 5
%>
info[<%=i%>] = new Array("<%=i%>","<%=j%>","<%=i%>");
<%j=j+1
next
%>
j=<%=j%>;

function changelocation1(locationid,j)
{
var slxid= document.getElementById("slxid")
slxid.length = 0;

var locationid=locationid;
var i;
for (i=0;i < j; i++)
{
if (info[i][1] == locationid)
{
slxid.options[slxid.length] = new Option(info[i][0], info[i][2]);
}
}

}
</script>
<a href="#" onclick="window.open('zi1.asp','','status=yes,width=200,height=200')"> 子窗口1 </a> <br /> <br />
<input name="he" type="text" readonly="true"> he <br />
<select name="slxid" id="slxid"></select>
  • 打赏
  • 举报
回复
难点就在给select添加选项,用js怎么做
这个倒不是很难,难点是与数据库挂钩
  • 打赏
  • 举报
回复
....
chinank 2008-04-14
  • 打赏
  • 举报
回复
难点就在给select添加选项,用js怎么做?
  • 打赏
  • 举报
回复
解决了就好
  • 打赏
  • 举报
回复
select(产品规格)也被从数据库中增加好几个选项
就这个复杂点
  • 打赏
  • 举报
回复
B页面关闭,A页面的textbox被负值产品名称
这个容易解决
<script>
function xs(){
window.opener.document.getElementById("he").value+= parseInt(document.getElementById("zi1").value)
window.close();
}
</script>
使用这样的就可以解决掉

28,391

社区成员

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

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