Jquery FrameSet設定

4271 ワード


Jqueryを使ってに肌を入れ替え、
 
1.cssBasePage.jspも肌をリンクしましたcss
<link href="<%=path %>/css/${cookie.b2cPlatform.value==null?'jf_blue':
	cookie.b2cPlatform.value}.css" rel="stylesheet" type="text/css"  id="cssfile" />

 
2.frameTop.jspページ皮膚を切り替えるJSコード
	//     
	function setCssFile(id){
		//switchSkin(id);
		$("#cssfile").attr("href","css/"+ id +".css"); //      
		try{
			$(window.parent.frames['main'].document).find("#cssfile")
                                    .attr("href","css/"+ id +".css");//     
			$(window.parent.frames['leftFrame'].document).find("#cssfile")
                                    .attr("href","css/"+ id +".css");//     
			$(window.parent.frames['midFrame'].document).find("#cssfile")
                                    .attr("href","css/"+ id +".css");//      
		}catch(e){ }
		$.cookie( "b2cPlatform" ,  id , { path: '/', expires: 10 });//       cookie 
	}
</script>

 
3.frameTop.jspページボリュームコンテンツ
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>frame top page</title>
		<%@ include file="/cssBasePage.jsp"%>
         </head>
<body>
<div class="skin">
	<a href="javascript:setCssFile('jf_blue');">
	<img width="15" height="16" alt="grass" src="images/ocean.gif" /></a>
	<a href="javascript:setCssFile('jf_red');">
	<img width="15" height="16" alt="grass" src="images/oyster.gif" /></a>
	<a href="javascript:setCssFile('jf_green');">
	<img width="15" height="16" alt="grass" src="images/grass.gif" /></a>
</div>
</body>
 
4.フレームページframeSet
1.<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
2.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
3.<html xmlns="http://www.w3.org/1999/xhtml">  
4.    <head>  
5.        <title>   </title>  
6.    </head>  
7.    <frameset cols="*" rows="75,*" style="height: 100%; overflow:hidden;">  
8.        <frame id="head" scrolling="no" marginwidth="0" marginheight="0" src="<%=request.getContextPath() %>/Login_loginTop" name="topFrame" frameborder="0" scrolling="no" noresize="noresize" id="topFrame"/>  
9.        <frameset  cols="185,8,*" id="myFrame" >  
10.            <frame frameborder="0" scrolling="auto" src="<%=request.getContextPath() %>/LeftMenu_leftMenuShow" name="leftFrame" id="leftFrame"/>  
11.            <frame frameborder="0" scrolling="no" noresize="noresize" id="midFrame" name="midFrame" src="<%=request.getContextPath() %>/Login_loginSwitch"/>  
12.            <frame frameborder="0" scrolling="auto" src="<%=request.getContextPath() %>/Login_loginRight" name="main"  id="main"/>  
13.        </frameset>  
14.        <noframes></noframes>  
15.    </frameset>  
16.</html>