日期:2014-05-18  浏览次数:20379 次

请问如何通过javascript获取iframe?
通过页面代码生成后在
<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

------解决方案--------------------
给标签加上名字就可以。iframe名.form名——这样就能取到名字为iframe名的iframe下名字为form名的form。
------解决方案--------------------
脚本在vs里也可以调试的。
用debugger或者断点断掉,然后右键快速监视。