关于Window.open [总结]

此为工作中总结出的。

于父页面oc1栏位输入值,当失去焦点时打开自页面。于子页面中连接数据库查询其他相关信息,然后传值回父页面。此为达到一个数据中转的功能。其他,如:验证,传值等可于同等方法下改写即可。(已通过测试)
父页面
<input type="text" name="oc1" onblur = "openwindow();">
<input type="text" name="oc2">
<input type="text" name="oc3">
<input type="text" name="oc4">
<input type="text" name="oc5">
<script language="javascript">
function openwindow()
{
 var c1 = document.getElementById("oc1").value;
 var URL = "new.asp?LotID=" + escape(c1);
 window.open(URL,'New_window','height=100; width=200; resizable=0; scrollbars=0; toolbar=0;top=0;left=0;status=0');
}
</script>
标注:escape()为把其中参数转换成为Unicoal型别 

子页面
<HTML><BODY>读取中(Retrieve Data)...</font>
<SCRIPT LANGUAGE="VBScript">
Dim con,sSQL
<%
 LotID = Request("LotID") '取出主表单所传过来的值
 '连接数据库
 Set con = Server.Createobject("ADODB.Connection")
 con.Open("Driver={SQL Server};Server=数据服务器地址;UID=用户名;PWD=密码;Database=数据库名称")
 set rs=server.createobject("ADODB.Recordset")
 sql="select prod_id,lottype,qty,priority from NonProdBankInOutLotInfo_v where lot_id='" & LotID & "'"  '查询所需数据
     rs.open sql,con,3,1 
 
 if not rs.eof then
%>
 opener.document.getElementById("oC2").value = "<%=rs("lottype")%>"
 opener.document.getElementById("oc3").value = "<%=rs("prod_id")%>"
 opener.document.getElementById("oc4").value = "<%=rs("priority")%>"
 opener.document.getElementById("oc5").value = "<%=rs("qty")%>"
<%
 set rs = Nothing
 con.close
 set con=Nothing

 else
%>
    msgbox "Invalid LotID, please try again!" 
<%
 end if
%>
self.close
</SCRIPT>
</BODY></HTML>  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值