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

JS操作 <frameset> <frame> 对象+js给frameset设置rows
###我的应用(js给frameset设置rows)
1.框架frameset页面
<frameset cols="*" rows="74,*" style="height: 100%;" framespacing="0" id="globalFrame">
  <frame scrolling="no" marginwidth="0" marginheight="0" src="<%=request.getContextPath() %>/Login_loginTop"
     name="topFrame" frameborder="0" scrolling="no" noresize="noresize" id="topFrame"/>
  <frameset  cols="166,8,*" id="myFrame" >
	<frame frameborder="0" scrolling="no" src="<%=request.getContextPath() %>/LeftMenu_leftMenuShow" 
	   name="leftFrame" id="leftFrame" />
	<frame frameborder="0" scrolling="no" noresize="noresize" id="midFrame" name="midFrame" 
	   src="<%=request.getContextPath() %>/Login_loginSwitch"/>
	<frame frameborder="0" scrolling="auto" src="<%=request.getContextPath() %>/Login_loginRight" 
	   name="main"  id="main"/>
  </frameset>
  <noframes></noframes>
</frameset>
?
?2.frametop页,如果有升级公告,将主框架页的rows调为102,否则默认为74
/*系统升级公告*/
setInterval("showUpGrade()", 1000*60*10);
function showUpGrade(){
	$.ajax({
		type:'post',
		url:'Login_showUpGrade',
		async: false ,
		dataType:'json',
		success:function(data){
	 		if(data.upGradeState=="true"){
	 			window.parent.frames['globalFrame'].rows=data.frameRows;
	 			$("#top_notice").html(data.upGradeString);
	 			$("#top_notice").css("display", "block");
	 		}
	 		else{
	 			window.parent.frames['globalFrame'].rows=data.frameRows;
	 			$("#top_notice").css("display", "none");
	 		}
	 	}
	});
}
?然后页面的<body? onload="showUpGrade()">

3.LoginAction中查询升级公告,并设置状态,是否有升级公告
/**
 * 显示系统升级公告
 * @author mengxianjun
 * @date 2011-11-22 下午16:09:29
 */
public void showUpGrade(){
	String upGradeString = "";
	String upGradeState = "false";//公告状态
	String frameRows = "74,*";//主frameset页的rows大小
	try {
		TUpgrade upGrade = new TUpgrade();
		upGrade.setNowDate(new Date());
		
		List<TUpgrade> upGradeList = UpGradeService.queryAll(upGrade);
		if(upGradeList.size()>0){
			upGradeString = "升级公告:";//系统升级公告字符串
			for(TUpgrade myTUpgrade: upGradeList){
				upGradeString = upGradeString+myTUpgrade.getUpgradeInfo();
			}
			upGradeState = "true";
			frameRows = "102,*";
		}
		
		PrintWriter out = this.getResponse().getWriter();
		out.print("{\"upGradeString\":\""+upGradeString+"\",\"upGradeState\":\""+
				upGradeState+"\",\"frameRows\":\""+frameRows+"\"}");
	}catch (Exception e){
		log.error("LoginAction's showUpGrade():" + e.fillInStackTrace());
	}
}
? 4.sqlMap
<select id="queryModel"  parameterClass="com.hanpeng.base.phone.model.TUpgrade" resultClass="com.hanpeng.base.phone.model.TUpgrade">
	select
		UPGRADE_NUM as upgradeNum ,
		UPGRADE_INFO as upgradeInfo ,
		CREATE_DATE as createDate ,
		PUBLISH_DATE as publishDate ,
		FINISH_DATE as finishDate ,
		EMPLOYEE_ID as employeeId
	from (select * from t_upgrade t where t.finish_date>=sysdate order by t.create_date desc) where rownum = 1
</select>
?
============================================================================================

框架编程概述
一个HTML页面可以有一个或多个子框架,这些子框架以<iframe>来标记,用来显示一个独立的HTML页面。这里所讲的框架编程包括框架的自我控制以及框架之间的互相访问,例如从一个框架中引用另一个框架中的JavaScri