两个iframe联动刷新 JS代码

1、iframe代码:

1 <iframe id="famUpload" src="report.asp?syear=<%=Year(now())%>" width="660" height="290" scrolling="no" frameborder="0"></iframe>

2 <iframe id="famStat" name="famStat" src="Statistics.asp" width="660" height="500" scrolling="auto" frameborder="0"></iframe>

2、report.asp部分代码

 1 <body onLoad="locationHref(<%=syear%>)">

 2 <script language="javascript" type="text/javascript">

 3     function locationHref(str)

 4     {                     

 5         parent.document.getElementByIdx_x('famStat').src = "Statistics.asp?syear="+str;

 6         parent.document.getElementByIdx_x('famStat').location.reload(true);                

 7     }

 8     function loadthis(str)

 9     {

10         parent.document.getElementByIdx_x('famUpload').src = "report.asp?syear="+str;

11         parent.document.getElementByIdx_x('famUpload').location.reload(true);

12     }

13 </script>

 

你可能感兴趣的:(iframe)