如何在一个iframe中对另一iframe动态定位不同页面 急~~~~请教各位大侠,现在主页面上有两个iframe,iframe1和iframe2,iframe1中有一个树型菜单,如何实现双击iframe1中树型菜单的item值来改变iframe2中的src值,实现根据iframe1的不同item来定位iframe2中不同的页面。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 事件触发的时候改变路径$("#ifrme_id").attr("src", "http://mp3.baidu.com/"); 在iframe1中:window.parent.document.frames["iframe2"].document.getElementById("id")可以试一下 [Quote=引用 2 楼 yuxh81 的回复:]在iframe1中:JScript codewindow.parent.document.frames["iframe2"].document.getElementById("id")我试了一下没反应 那个代码只是参考,其用于在一个iframe中,访问兄弟(处在同一个父页面)iframe中的元素 我在iframe1中写js,目前点击不同的item能得到不同的页面,但没法改变iframe2的src。 那我如果对iframe2的src进行动态改变的话,是否可以这样window.parent.document.frames["iframe2"].src=对应的页面 window.parent.document.frames["iframe2"].src=对应的页面,好像可以,但是iframe2中无法动态的加载对应的页面,iframe2没反应,要如何才能让iframe2动态加载???? 好像是这样的你再搜一下 “js刷新iframe”也可能是思路错了,把问题搞复杂了 <a href="url" target="1.aspx">链接</a><a href="url" target="1.aspx#divid">链接</a> 纠正下href 和 target写反了~~~~~~~ 我在iframe1里写<script type="text/javascript"> function onNodeClicking(sender, args) { window.parent.iframe2.src = "111.aspx"; alert(window.parent.document.frames["iframe2"].src); window.parent.document.frames["iframe2"].location.load(); //alert(window.parent.document.frames["iframe2"].src); }</script>不起作用,iframe2并未加载111.aspx,我该怎样实现,在iframe1中动态加载iframe2中的页面?? <script type="text/javascript"> function onNodeClicking(sender, args) { window.parent.iframe2.src = "111.aspx"; //alert(window.parent.document.frames["iframe2"].src); window.parent.document.frames["iframe2"].location.load(); //alert(window.parent.document.frames["iframe2"].src); }</script> 这样试一下: window.parent.document.getElementById("iframe1").src=url; 我的意思是想在iframe1中得到打开的页面路径,在iframe2中打开, 是的,这是在iframe1中执行的js代码,你试一下:window.parent.document.getElementById("iframe2").src="http://www.csdn.net"; //iframe2是id 关于ASP.NET需要多个页面共享一些变量的疑惑 JS 大数据传输 找一个好的文本编辑器 页面刷新问题 |M| 自我感觉不会有错的Cookie操作;却怎么也不能正确读取我的Cookie 难道是我的机子机品不好 ------- 快来救救 --- 求助:如何为一个站点的不同页面实行不同的编码?globalization是全局的,不可行 在XP系统下安装.NET,紧急求助!!! dropdownlist如何改变后即触发 请问怎么循环找到 Form 里的所有控件,并且把这些控件清空或赋值? 如何Html Decoding? MVC 3.0 怎么在web.config里设置出错页面? 框架问题
$("#ifrme_id").attr("src", "http://mp3.baidu.com/");
可以试一下
在iframe1中:JScript code
window.parent.document.frames["iframe2"].document.getElementById("id")
我试了一下没反应
好像是这样的
你再搜一下 “js刷新iframe”也可能是思路错了,把问题搞复杂了
<a href="url" target="1.aspx#divid">链接</a>
href 和 target写反了~~~~~~~
<script type="text/javascript">
function onNodeClicking(sender, args)
{
window.parent.iframe2.src = "111.aspx";
alert(window.parent.document.frames["iframe2"].src);
window.parent.document.frames["iframe2"].location.load();
//alert(window.parent.document.frames["iframe2"].src);
}
</script>
不起作用,iframe2并未加载111.aspx,我该怎样实现,在iframe1中动态加载iframe2中的页面??
function onNodeClicking(sender, args)
{
window.parent.iframe2.src = "111.aspx";
//alert(window.parent.document.frames["iframe2"].src);
window.parent.document.frames["iframe2"].location.load();
//alert(window.parent.document.frames["iframe2"].src);
}
</script>
window.parent.document.getElementById("iframe1").src=url;
window.parent.document.getElementById("iframe2").src="http://www.csdn.net"; //iframe2是id