请问如何通过javascript获取iframe?

hongcha99 2012-03-15 02:14:42
通过页面代码生成后在
<iframe width="830" height="890" id="ifrReport" src="" frameBorder="0" scrolling="no"> 下面有个

<form name="form1" id="form1" action="NE_Q_Ds.aspx" method="post">在form下面有

<iframe width="830" height="855" id="iframeReport" src="http://127.0.0.1/ReportServer/Pages/ReportViewer.aspx?%2fEA_Standard%2fZH_NE_Q_Ds_Month&rs%3aCommand=Render&User=admin" frameBorder="0">下面有

<form name="ReportViewerForm" id="ReportViewerForm" style="width: 100%; height: 100%;" action="ReportViewer.aspx?%2fEA_Standard%2fZH_NE_Q_Ds_Month&rs%3aCommand=Render&User=admin" method="post">下面有个
<iframe name="ReportViewerControl_ctl00_ctl15_ctl01" id="ReportViewerControl_ctl00_ctl15_ctl01" src="javascript:'';" frameBorder="0" style="position: absolute; display: none;" onclick="event.cancelBubble=true;" onactivate="event.cancelBubble=true;">

请问我如何通过JavaScript获取ifrReport,form1,iframeReport,ReportViewerForm最后获取到ReportViewerControl_ctl00_ctl15_ctl01
...全文
100 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hongcha99 2012-03-15
  • 打赏
  • 举报
回复
你嫩给我写一下吗?
hongcha99 2012-03-15
  • 打赏
  • 举报
回复
var ifr1 = window.parent.frames['ifrReport'];
alert(ifr1)
var form = window.parent.frames['ifrReport'].getElementById('form1');

这样写也不对
Chyan 2012-03-15
  • 打赏
  • 举报
回复
脚本在vs里也可以调试的。
用debugger或者断点断掉,然后右键快速监视。
hongcha99 2012-03-15
  • 打赏
  • 举报
回复
var form = window.frames['ifrReport'].form('form1');

这样可以?
hongcha99 2012-03-15
  • 打赏
  • 举报
回复
var ifr1 = window.frames['ifrReport'];
var form = ifr1.window.frames('form1');
var ifr2 = form .window.frames['iframeReport'];
var ifr3 = ifr2.window.frames('ReportViewerForm')
var ifr4 = ifr3.window.frames[‘ReportViewerControl_ctl00_ctl15_ctl01’]


我这样写好像都不对
Chyan 2012-03-15
  • 打赏
  • 举报
回复
给标签加上名字就可以。iframe名.form名——这样就能取到名字为iframe名的iframe下名字为form名的form。

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧