<!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 type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".btn").click(function () {
            $("#dd").html("<div class='div'><iframe border='0' width='100%' onload='SetWinHeight(this)' height='100%' src='1.html'></iframe><div class='close'>×</div></div>");            $(".close").click(function () {
                $(".div").remove();
            })
        })    });    function SetWinHeight(obj) {
        obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
        obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';
    } 
</script><style>
*{
    margin:0;
    padding:0;
    }
.div{
    position:absolute;
    top:50px;
    left:50px;
    border:1px solid #06C;
    }
</style>
</head>
 
<body>
<input class="btn" type="button" value="点击" />
<input class="text" type="text" />
<div id="dd"></div>
</body>
</html>

解决方案 »

  1.   

    1.
    <iframe id="frame" border='0' width='100%' height='100%' src='表格1.html' onload="height()"></iframe>function height2(){ 
    var frame = document.getElementById("frame"); 
    var height; 
    if (frame.Document){ 
        height = frame.Document.body.scrollHeight + 20 + "px"; 
    }else{ 
        height = frame.contentDocument.body.scrollHeight+ 20 + "px"; 
    }
    $(".div").css("height",height);

    2.$(".div").remove();3.iFrame跨域传值,查一下就是。
      

  2.   


    <!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>表格2</title>
    <style type="text/css">
    *{
    margin:0;
    padding:0;
    }
    body{
    font-size:12px;
    }
    a{
    text-decoration:none;
    }
    .bg_congtnet{
    width:725px;
    float:left;
    border:1px solid #999999;
    }.bg_congtnet_zhong{
    width:725px;
    float:left;
    }
    .bg_congtnet_zhong .zhong_td1{
    width:40px;
    height:24px;
    text-align:center;
    border-right:1px solid #D2D2D2;
    border-bottom:1px solid #D2D2D2;
    }
    .bg_congtnet_zhong .zhong_td2{
    width:155px;
    height:24px;
    text-align:center;
    line-height:24px;
    border-right:1px solid #D2D2D2;
    border-bottom:1px solid #D2D2D2;
    }
    .bg_congtnet_zhong .zhong_td3,.bg_congtnet_zhong .zhong_td4{
    width:130px;
    height:24px;
    line-height:24px;
    border-right:1px solid #DCDCDC;
    border-bottom:1px solid #D2D2D2;
    }
    .bg_congtnet_zhong .zhong_td3{
    text-align:center;
    }
    .bg_congtnet_zhong .zhong_td4{
    text-align:left;
    }
    </style>
    </head>
    <body>
    <div class="bg_congtnet">
     <div id="zhong_fux" class="bg_congtnet_zhong">
       <table class="list" cellpadding="0" cellspacing="0" border="0">
      <tbody>
       <tr>
        <td class="zhong_td1">1</td>
        <td class="zhong_td2">姓名</td>
        <td class="zhong_td3">女</td>
        <td class="zhong_td4">22</td>
        <td class="zhong_td4">1989-11-11</td>
        <td class="zhong_td4">2012-12-31</td>
        <td></td>
       </tr>
       <tr>
        <td class="zhong_td1">2</td>
        <td class="zhong_td2">姓名2</td>
        <td class="zhong_td3">女</td>
        <td class="zhong_td4">22</td>
        <td class="zhong_td4">1989-11-11</td>
        <td class="zhong_td4">2012-12-31</td>
        <td></td>
       </tr> 
       <tr>
        <td><input type="button" value="确定" /></td>
       </tr>  
      </tbody>
     </table>
     </div>
    </div>
    </body>
    </html>
    这里是我表格2的内容 请问下当我选择表格第一行的时候 点击确定 表格第二列的内容显示到<input class="text" type="text" />这种跨域传值应该怎么做啊
      

  3.   

    <!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>表格2</title>
    <style type="text/css">
    *{
        margin:0;
        padding:0;
        }
    body{
        font-size:12px;
        }
    a{
        text-decoration:none;
        }
    .bg_congtnet{
        width:725px;
        float:left;
        border:1px solid #999999;
        }
     
    .bg_congtnet_zhong{
        width:725px;
        float:left;
        }
    .bg_congtnet_zhong .zhong_td1{
        width:40px;
        height:24px;
        text-align:center;
        border-right:1px solid #D2D2D2;
        border-bottom:1px solid #D2D2D2;
        }
    .bg_congtnet_zhong .zhong_td2{
        width:155px;
        height:24px;
        text-align:center;
        line-height:24px;
        border-right:1px solid #D2D2D2;
        border-bottom:1px solid #D2D2D2;
        }
    .bg_congtnet_zhong .zhong_td3,.bg_congtnet_zhong .zhong_td4{
        width:130px;
        height:24px;
        line-height:24px;
        border-right:1px solid #DCDCDC;
        border-bottom:1px solid #D2D2D2;
        }
    .bg_congtnet_zhong .zhong_td3{
        text-align:center;
        }
    .bg_congtnet_zhong .zhong_td4{
        text-align:left;
        }
        .focus{background:#f00;color:White;}
    </style>
    </head>
    <body>
    <div class="bg_congtnet">
     <div id="zhong_fux" class="bg_congtnet_zhong">
       <table class="list" cellpadding="0" cellspacing="0" border="0">
      <tbody>
       <tr>
        <td class="zhong_td1">1</td>
        <td class="zhong_td2">姓名</td>
        <td class="zhong_td3">女</td>
        <td class="zhong_td4">22</td>
        <td class="zhong_td4">1989-11-11</td>
        <td class="zhong_td4">2012-12-31</td>
        <td></td>
       </tr>
       <tr>
        <td class="zhong_td1">2</td>
        <td class="zhong_td2">姓名2</td>
        <td class="zhong_td3">女</td>
        <td class="zhong_td4">22</td>
        <td class="zhong_td4">1989-11-11</td>
        <td class="zhong_td4">2012-12-31</td>
        <td></td>
       </tr> 
       <tr>
        <td><input type="button" value="确定" onclick="setText()" /></td>
       </tr>  
      </tbody>
     </table>
     <script>
     var tr
     parent.$('#zhong_fux tr', document).not(':last').click(function () {
         parent.$('#zhong_fux tr', document).removeClass('focus');
         tr = parent.$(this).addClass('focus');
     });
     function setText() {
         if (!tr) alert('先选择行先')
         else {
             parent.$('input.text', parent.document).val(tr.find('td:eq(1)').text());
         }
     }
     </script>
     </div>
    </div>
    </body>
    </html>重设iframe的宽和高用这个。。忘记xhtml申明问题了
        function SetWinHeight(obj) {
            obj.style.height = Math.max(obj.contentWindow.document.body.scrollHeight, obj.contentWindow.document.documentElement.scrollHeight) + 'px';
            obj.style.width = Math.max(obj.contentWindow.document.body.scrollWidth, obj.contentWindow.document.documentElement.scrollWidth) + 'px';
        } 
      

  4.   

    请问下 我怎么才能点击确定的时候 把$(".div").remove();掉
      

  5.   

     function setText() {
         if (!tr) alert('先选择行先')
         else {
             parent.$('input.text', parent.document).val(tr.find('td:eq(1)').text());
     parent.$(".div", parent.document).remove();
         }
     }
    都是基础的知识,多学点基础了