当前位置:编程学习 > C#/ASP.NET >>

asp.net MVC3 无法获取iframe里面元素的值

首页:
 <div id="top">
            <iframe src="../CommonView/SharedTop" id="topFrame" name="topFrame" scrolling="no" width="100%" height="56"></iframe>
        </div>
 <div id="main">            
            <iframe src="../Index/Intro" id="mainContent" name="mainContent" scrolling="no"  width="100%" height="460"></iframe>
        </div>
        <div id="bottom">
            <iframe src="../CommonView/SharedBottom" id="bottomFrame" name="bottomFrame" scrolling="no" width="100%" height="33"></iframe>
        </div> 

我现在想在 <div id="main"> 这个div中嵌套的页面中获取头部页面中元素(我想获取用户名,用户名在头部)。

下面是我从网上找的一些方法都不行:
//var aa = $("#uName").html(); //$("#uName",document.frames("topFrame").document).html();

//var aa = window.frames('topFrame').document.getElementById('uName').value;
//var aa = $("#uName", document.frames('topFrame').document);//找不到成员
//var aa = $("#topFrame", document.frames('topFrame').document).html();
//var aa = $(window.frames["topFrame"].document).find("#uName").html(); //window.frames["topFrame"].document是空或不是对象
//var aa = $("#topFrame").find("#uName").html();//null
asp.net MVC3  iframe --------------------编程问答-------------------- $(document.getElementById('topFrame').contentWindow.document.getElementById('uName').value).html(),试试这个 --------------------编程问答-------------------- document.frames["topFrame"].document.getElementById('uName').innerHTML;//试试 --------------------编程问答--------------------

--------------------编程问答-------------------- 自己顶一下。。。。 --------------------编程问答-------------------- 顶,顶,顶,顶.......
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,