源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

javascript 子窗体父窗体相互传值方法

  • 时间:2022-11-03 06:12 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:javascript 子窗体父窗体相互传值方法
编程素材网精简使用版本,一般情况好多cms都有一些这样的函数。dedecms中的选择相关文章也是用的这样的函数。下面给出具体的代码。 父页面核心代码:
[url=javascript:selAll()]href="javascript:noSelAll()">取消</A>   <A class=inputbutx href="javascript:ReturnValue()">把选定值加到列表</A>
一下是补充: //模式窗体传值 <!-- ====== 父窗体,我取名为parentform.html ==== --> <!-- ============= 父窗体代码结束 ============= --> <!-- ======= 子窗体:取名为childform.html  ======= -->
[url=javascript:doPassToParent()]</BODY> </HTML> <script language="javascript" type="text/javascript"> document.getElementById("childTextBox").value = window.dialogArguments.document.getElementById("parentTextBox").value; function doPassToParent() { if(document.getElementById("childTextBox").value.length <=0) { alert("请填写数据"); return; } window.returnValue = document.getElementById("childTextBox").value; window.close(); } </script>
//子窗体和父窗体传值 1.新建两个页面 一个是 Parent.html
另一个是子窗体 :
[u]复制代码[/u] 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>子窗体</title> <script language="javascript" type="text/javascript" > function CloseWind(){ opener.setValue("传值到父窗体"); window.close(); } </script> </head> <body> <form id="form1" name="form1" method="post" action=""> <label>关闭 <input type="button" name="btn_Close" id="btn_Close" value="按钮" onclick="CloseWind();" /> </label> </form> </body> </html>
2.通过子窗体执行的父窗体的setValue(m_strValue)来执行赋值操作.
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部