我始终取不到值/////严重郁闷
jquery  模态对话框,我如何获得子子窗口的值啊
下载网址,http://download.csdn.net/source/1514299/
演示网址:
http://blue.bokequn.cn/demos/modalbox/demo/demos.html 空有一个遮罩,取不到值,好郁闷

解决方案 »

  1.   

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    <!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" lang="zh-cn">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="author" content="Tank,Scrat,xiaoyuehen" />
    <meta name="keywords" content="网页设计,XHTML,CSS,DIV,XHTML标准,WEB标准,WEB标准教程,网站重构, CSS布局, XHTML+CSS,layout, usability,搜集库,soujiku, CSS+DIV" />
    <meta name="description" content="web标准教程站点,推动web标准在中国的应用." />
    <title>modal box demos</title>
    <link type="text/css" rel="stylesheet" href="style.css" />
    <script type="text/javascript" src="../scripts/jquery.js"></script>
    <script type="text/javascript" src="../scripts/bgiframe.js"></script>
    <link type="text/css" rel="stylesheet" href="../source/modalbox.css" />
    <script type="text/javascript" src="../source/modalbox.js"></script><style type="text/css">
        .test
        {
            clear: both;
            /*
            position: absolute;
            left: 100px;
            top: 50px;
            z-index: 4;
            */
            border: 1px solid blue;
            width: 200px;
            height: 400px;
        }
    </style>
    </head><body>
        <select name="fffff">
            <option value="fffff">fffff</option>
        </select>
        
        <input id="Text1" type="text"  value ='fdfdfdf'/>
        <input type="button" id="testbutton" value="测试一下"  />
        <input type="button" id="resizebutton" value="改变大小" />
        <input type="button" id="movebutton" value="移动位置" />
        <input type="button" id="closebutton" value="关闭最后一个" />
        <div class="test" id="Dtest">
            <h2>title</h2>
            网页设计,XHTML,CSS,DIV,XHTML标准,WEB标准,WEB标准教程,网站重构, CSS布局, XHTML+CSS,layout, usability,搜集库,soujiku, CSS+DIV
        </div>
        <span  id='result'></span>
    </body>
    </html>
    <script type="text/javascript">
        $(document).ready(function(){
            /*
            $(".test").bgiframe();
            $(".test h2").mousedown(function(){
                $(".test:eq(0)").ppdrag();
            });
            */
    //                                            $("#testbutton").click(
    //                                            function (){
    //                                        var c= $('#Text1').val();
    //                                          
    //                                            $("#result").html(c);
    //                                            }
    //                                            )
            
            $("#testbutton").click(function(){
                //$.modalbox.show();
                $.modalbox.show({
                    modal: true,
                    
                    contentType: "url",
                    showCancel: false, 
                     onclose: function (){
                     
                     
                   var a=$("#TextBox1").text();
                   alert (a);
                    //$("#result").html(a  ); 
               //     alert($("#TextBox1").val());
                    
                     }
                                       ,          
                      
                    
                      
                    content: 'child.aspx'
                });
            });//        $("#resizebutton").click(function(){
    //            $.modalbox.resize({w: 300, h: 400});
    //        });//        $("#movebutton").click(function(){
    //            $.modalbox.moveto({x: 40, y: 60});
    //        });//        $("#closebutton").click(function(){
    ////        alert ('你好!');
    ////            $.modalbox.close();
    //        });        
            //$.modalbox.show();
        })
    </script>
      

  2.   

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="child.aspx.vb" Inherits="child" %><html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="author" content="Tank,Scrat,xiaoyuehen" />
    <meta name="keywords" content="网页设计,XHTML,CSS,DIV,XHTML标准,WEB标准,WEB标准教程,网站重构, CSS布局, XHTML+CSS,layout, usability,搜集库,soujiku, CSS+DIV" />
    <meta name="description" content="web标准教程站点,推动web标准在中国的应用." />
    <title></title>
    <script type="text/javascript" src="../scripts/jquery.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            //parent.$.modalbox.resize({w: 500, h: 300});
            //parent.$.modalbox.moveto("center");
        })
    </script>
    <style type="text/css">
        html, body
        {
            overflow: auto;
            overflow-x:hidden;
        }    
        *{ 
            scrollbar-3dlight-color:#D4D0C8; /*- 最外左 -*/ 
            scrollbar-highlight-color:#fff; /*- 左二 -*/ 
            scrollbar-face-color:#E4E4E4; /*- 面子 -*/ 
            scrollbar-arrow-color:#666; /*- 箭头 -*/ 
            scrollbar-shadow-color:#808080; /*- 右二 -*/ 
            scrollbar-darkshadow-color:#D7DCE0; /*- 右一 -*/ 
            scrollbar-base-color:#D7DCE0; /*- 基色 -*/ 
            scrollbar-track-color:#;/*- 滑道 -*/ 
        }
    </style>
    </head><body><form runat ="server">
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        </form>
        
        
        
    </body>
    </html>
      

  3.   

    var textbox=document.getElementById("modalbox-iframe").contentWindow.document.getElementById("TextBox1")
    alert(textbox.value);//你页面中的文件跟空上不一样,里面没有TextBox1这个方本框
      

  4.   

    jq的选择器不能跨iframe来查找元素,
      

  5.   

    var textbox=document.getElementById("modalbox-iframe").contentWindow.document.getElementById("TextBox1")
    alert(textbox.value);//你页面中的文件跟空上不一样,里面没有TextBox1这个方本框还是不可以的空有一个遮罩,取不到值,好郁闷 
      

  6.   

    所以你要用我3楼写的那样,先找到iframe的window对象,才能正确的找到元素
      

  7.   

    这个东西调用时jquery中的,感觉很困难啊
      

  8.   

    终于找到原因了,在onclose中调用 var textbox=document.getElementById("modalbox-iframe").contentWindow.document.getElementById("ttext") ;这句话时已经关闭了,那个层已经从文档流中移除,所以找不到了,
    这个东东的名字叫什么,我看看文档
      

  9.   

    http://download.csdn.net/source/1514299/
    演示网址:
    http://blue.bokequn.cn/demos/modalbox/demo/demos.html 
      

  10.   

    看看这个对您有没有帮助.
    http://topic.csdn.net/u/20091121/15/22fb2dd3-47d9-46ba-ba39-d36603ccab60.html?44598
      

  11.   

    我的下载地址:http://www.517181.cn/demo.rar
      

  12.   

    不用了,已经搞定。,
    你在onOk中获取 就可以了,我看了源代码,他没有onbeforeclose之类的事件,只能是onOK了,
    这个是我的演示地址:http://dl.dropbox.com/u/2555620/demo.html
    那个文本框里只能输入数字 ,你点ok后会弹出第一个文本框 里的数字,你查看源代码
      

  13.   

    我没用过jq不好意思,我们有自己的js框架系统