//返回值给父窗体
function returnParent(value) {//获取子窗体返回值
   var parent = window.dialogArguments; //获取父页面
   //parent.location.reload(); //刷新父页面
   if (parent != null && parent != "undefined") {
       window.returnValue = value; //返回值
       window.close(); //关闭子页面
   }
//window.opener.document.getElementById("ActivityPic");//直接操作父窗体元素

//$(selector, window.parent.document);用于框架类页面
//$(selector, window.opener.document);这个适合单独打开的页面

return;

}

//打开模式子窗体,获取返回值进行操作

function showModalOnly(me, url) { //弹出窗体 ,单选

   var hidden = document.getElementById(me); //获取隐藏的控件

   if (hidden != null && hidden.value != null && hidden.value.length > 0) {

       alert("此处为单选,请先删除已有的选项,再次尝试选择。");

       return;

   }

   var reValue = window.showModalDialog(url, window, "dialogHeight:500px; dialogWidth:987px;  status:off; scroll:auto");

if (reValue == null || reValue == "undefined" || reValue == "") {

       return; //如果返回值为空,就返回

   }

   var index = reValue.split("^"); //分割符 ^ 的位置

   if (index[0] == null || index[0] == "undefined" || index[0].length < 1) {

       return;

   }

   var hid = index[0].split('&'); //为隐藏控件赋值

   var view = index[1].split('&'); //显示值

   var content = ""; //需要添加到check中的内容

if (hid != null && hid.length == 2) {

       var i = 0;

if (hid[i] != "undefined" && hid[i] != "" && view[i + 1] != "undefined" && view[i + 1] != "") {

content += '<table  id="' + hid[i]

           + '" class="deleteStyle"><tr><td><img src="../../../Images/deleteimge.png" title="点击删除"  alt="删除" onclick=" deleteTable('

           + "'" + hid[i] + "'," + "'" + me + "'" + ');" /></td><td>' + view[i + 1] + '</td></tr></table>';

hidden.value = hid[i]; //为隐藏控件赋值

           var c = document.getElementById("check" + me);

           c.innerHTML += content;

           return;

       }

   }

   alert("请只选择一条数据。");

   return;

}

function openUploadWindow(url, width, height,left,top) {
if(width==null) width=987;
if (height == null) height = 500;
if (left == null) left = 200;
if (top == null) top = 200;
//window.open(url, 'newwindow', 'height=' + height + ',width=' + width + ',top=200,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
    window.showModalDialog(url, window, "dialogHeight:" + height + "px; dialogWidth:" + width + "px;status:off; scroll:auto;dialogLeft:"+left+"px;dialogTop:"+top+"px");
}

子窗体与父窗体传值操作的js示例的更多相关文章

  1. iframe-父子-兄弟页面相互传值(jq和js两种方法)

    参考文章: http://blog.csdn.net/u013299635/article/details/78773207 http://www.cnblogs.com/xyicheng/archi ...

  2. layer子窗口与父窗口传值

    layer作为优秀的jquery框架,可以用作弹出组件.日历.分页等,而且实现简单,只有几十k的大小. 此处给出弹出窗口时子窗口与父窗口的传值.js和css这里不展示引入(以下给出目录结构的图片),仅 ...

  3. 子窗体与父窗体调用对方js方法

    有时候为了减少一个页面内的代码量,会将部分内容放到子窗体中,如后台管理中用iframe来进行管理 <div> <iframe id="dviframe" src= ...

  4. 关于iframe/子窗体与父窗体的交互

    父子窗体交互方式 通过contentWindow交互 通过postMessage交互 通过contentWindow交互 主窗体内嵌的iframe或者是其通过js打开的新窗口都可以通过contentW ...

  5. asp.net子窗体与父窗体交互

    今天在项目上遇到了这个问题,其实只是window.returnValue的简单应用,不是asp.net的专属内容.作为积累,记录一个简单的实现模型. 图1  用到的文件 从图1中我们可以看到,只用到了 ...

  6. 易混淆的Window窗体与父窗体之间位置关系

    假设有abc三个窗体,a是最外层窗体,b是a的子窗体,c是b的子窗体 c.Top,c.Left,c.Bottom,c.Location等都是相对于B的左上角点的,子窗体的位置点都是相对于父窗体而言的, ...

  7. React子组件与父组件传值

    一 子组件向父组件传值 //子组件var Child = React.createClass({ render: function(){ return ( <div> 请输入邮箱:< ...

  8. .NET开发之窗体间的传值转化操作

    DOTNET开发之窗体间的传值转化操作 好想把自己最近学到的知识写下来和各位朋友分享,也希望得到大神的指点.今天终于知道自己要写点什么,就是关于WPF开发时简单的界面传值与简单操作. 涉及两个界面:一 ...

  9. C#_父窗体跟子窗体的控件操作

    很多人都苦恼于如何在子窗体中操作主窗体上的控件,或者在主窗体中操作子窗体上的控件.相比较而言,后面稍微简单一些,只要在主窗体中创建子窗体的时候,保留所创建子窗体对象即可. 下面重点介绍前一种,目前常见 ...

随机推荐

  1. [BUGFIX]__import_pywin32_system_module__

    import_pywin32_system_module 修复方法: 编辑 X:/Python27/Lib/site-packages/win32/lib/pywintypes.py 第114行 if ...

  2. Tomcat基础教程(四)

    一.将Web应用部署到Tomcat中 为什么要部署?将Web应用部署到Tomcat中,那么Tomcat就能找到相应的Web应用,当Tomcat启动时就会加载和初始化Web应用,而在Tomcat启动后, ...

  3. htm、html、shtml区别

    htm.html.shtml都是静态网页的后缀,三者也可以说都是只是扩展名不同,其他一样,都是静态的网页. htm和html是完全静态的网页不通过服务器编译解释直接送出给浏览器读取的静态网页,以htm ...

  4. 反射实体自动生成EasyUi DataGrid模板

    用EasyUi Datagrid展示数据的时候总是要一下这样一段代码 <table id="dt" class="easyui-datagrid"> ...

  5. PHP传引用报错(5.4版本)

    php5.3系列版本以及以前版本,传引用没有什么问题,升级到php5.4以后,传引用的地方,全报错 Fatal error: Call-time pass-by-reference has been ...

  6. 【HDU 5381】 The sum of gcd (子区间的xx和,离线)

    [题目] The sum of gcd Problem Description You have an array A,the length of A is nLet f(l,r)=∑ri=l∑rj= ...

  7. 【BZOJ 1594】 [Usaco2008 Jan]猜数游戏 (二分+并查集)

    1594: [Usaco2008 Jan]猜数游戏 Description 为了提高自己低得可怜的智商,奶牛们设计了一个新的猜数游戏,来锻炼她们的逻辑推理能力. 游戏开始前,一头指定的奶牛会在牛棚后面 ...

  8. 利用if else咱们结婚吧

    class Program    {        static void Main(string[] args)        {            while (true)           ...

  9. load dll

    Assembly myassembly = Assembly.LoadFrom("testdll.dll"); Type type = myassembly.GetType(&qu ...

  10. POJ -- 2002

    #include<iostream> #include<cstdio> #include<cstring> #include<string> #incl ...