日期:2014-05-16  浏览次数:20360 次

页面验证iframe中input后 iframe中的页面会从新加载
主页面
<div class="selectedDiv" id="content_tb" style="border:solid 0px red">            <iframe width="980px" scrolling="auto" height="510" frameborder="0"           src=""      name="reportInfoIframe" id="reportInfoIframe"></iframe>  
</div> 

<script type="text/javascript">
$(function(){
var tableType=$("#reportId").val();
if(tableType==0){
$("#reportInfoIframe").attr({"src":"tableIndex.jsp"});
}else if(tableType==1){
$("#reportInfoIframe").attr({"src":"table_01.jsp"});
}else if(tableType==2){
$("#reportInfoIframe").attr({"src":"table_02.jsp"});
}
        此方法为判断主页面iframe到底加载哪个子页面

$("#reportId").change(function(){
var type=$(this).val();
$.ajax({
url:'/Cyedu/Upload/UploadReport',
type:'post', 
dataType:'json',
data :{'ddate':$("#dataDate").val(),'rid':$("#reportId").val()},
success:function(){}
})
if(type==0){
$(".tab > div").removeClass("selectedDiv");
$("#content_tb").addClass("selectedDiv");
$("#reportInfoIframe").attr({src:"tableIndex.jsp"});
}else if(type==1){
$(".tab > div").removeClass("selectedDiv");
$("#content_tb").addClass("selectedDiv");
$("#reportInfoIframe").attr({src:"table_01.jsp"});
}else if(type==2){
$(".tab > div").removeClass("selectedDiv");
$("#content_tb").addClass("selectedDiv");
$("#reportInfoIframe").attr({src:"table_02.jsp"});
}
        });  
        此方法是主页面有一个下拉框,根据下拉框选择主页面的iframe到底链接到哪个子页面



$("#submitBtn").click(function(){//提交按钮

var tt = $(window.frames["reportInfoIframe"].document).find("#submit_btn");//找到iframe的页面中submit_btn按钮。
tt.click();
});

})

</script>

子页面 
table_01.jsp
html
<table  id="table" class="staTable" width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th colspan="3" rowspan="2">&nbsp;</th>
        <th width="12%" rowspan="2">校数</th>
        <th width="12%" rowspan="2">班数</th>
        <th colspan="2">在校生数</th>
        <th colspan="2">教职工数</th>
      </tr>
      <tr>
        <th width="12%">正式生数</th>
        <th width="12%">借读生数</th>
        <th width="12%">合计</th>
        <th width="12%">其中:教师</th>
      </tr>
             
      <tr>
        <th width="2%" rowspan="9" class="tdCo