日期:2014-05-16 浏览次数:20346 次
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>宽屏、标屏页面切换</title>
<style>
body { margin:0;}
#bigWidth { width:100%;}
#normalWidth { width:950px; margin:0 auto;}
.top { width:100%; height:60px; background:#666; overflow:hidden;}
.left { width:25%; height:200px; float:left; background:#09C;}
.right { width:75%; height:200px; float:right; background: #66C;}
.foot { width:100%; height:50px; background:#CCC;}
.clear { clear:both;}
.top span { display:block; margin:20px; width:100px; height:30px; background:#960; cursor:pointer;}
</style>
</head>
<body>
<script>
function addLoadEvent(func){
var onload=window.onload;
if(typeof window.onload !="function"){
window.onload=func;
}else{
window.onload=function(){
oldonload();
func();
}
}
}
function WS(){
var SB=document.getElementById("SB");
var bigWidth=document.getElementById("bigWidth");
var bigId=bigWidth.getAttribute("id");
SB.onclick=function(){
//alert("test");
bigWidth.setAttribute("id","normalWidth");
SB.innerHTML="宽屏";
}
}
addLoadEvent(WS);
</script>
<div id="bigWidth">
<div class="top"><span id="SB">标屏</span></div>
<div class="left"></div>
<div class="right"></div>
<div class="clear"></div>
<div class="foot"></div>
</div>
</body>
</html>
function WS(){
var SB=document.getElementById("SB");
var bigWidth=document.getElementById("bigWidth");
var bigId=bigWidth.getAttribute("id");
SB.onclick=function(){
//alert("test");
if(bigWidth.id=="bigWidth"){
bigWidth.setAttribute("id","normalWidth");
SB.innerHTML="宽屏";
}else{
bigWidth.setAttribute("id","bigWidth");
SB.innerHTML="标屏";
}
}
}