<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>index.html</title>
<script language="javascript" src="index.js"></script>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="index.css" type="text/css"></link> <script language="javascript">
function Jump(j){
for(i=0; i <2; i++) { 
       document.getElementById("bgi" + i).className="bgimg" + i; 
       if( i==j )      
           document.getElementById( "bgi" + i).style.display="block"; 
       else    
           document.getElementById( "bgi" + i).style.display="none"; 
      } 
}
</script>

</head>
<body background="images/beijing.jpg">
<div id="bg">
<div class="company">
公司图标
</div>
<div class="menucenter">
智能建筑集成系统
</div>
<div class="buts" align="left">
<table class="buttons">
<tr>
<td>
&nbsp&nbsp&nbsp&nbsp
<a href="# " onclick="Jump(0)" ><img src="images/1.jpg" />
</a>&nbsp&nbsp&nbsp&nbsp
</td>
<td>
<a href=" #" onclick="Jump(1)"><img src="images/2.jpg" />
</a>&nbsp&nbsp&nbsp&nbsp
</td>
<td>
<a href=" #" onclick="Jump(2)"><img src="images/3.jpg" />
</a>&nbsp&nbsp&nbsp&nbsp
</td>
<td>
<a href="http://community.csdn.net/"><img src="images/4.jpg" />
</a>&nbsp&nbsp&nbsp&nbsp
</td>
<td>
<a href="http://www.baidu.com"><img src="images/4.jpg" />
</a>&nbsp&nbsp&nbsp&nbsp
</td>
<td>
<a href="http://www.sohu.com"><img src="images/4.jpg" />
</a>&nbsp&nbsp&nbsp&nbsp
</td>
</tr>
</table>
<div class="times">
<script type="text/javascript">
document.write(Date())
</script>
</div>
</div>
</div>
<div class="cent" align="left">
<div class="bgimg0" id="bgs0" >主页背景图片<img />
<div class="bgimg1" id="bgs1" style="display:none">第一个页面<img /></div>
<div class="bgimg2" id="bgs2" style="display:none">第二个页面<img /></div>
<table class="floor" border="2">
<tr>
<th>
select floor
</th>
</tr>
<tr>
<td>
ninth floor
</td>
</tr>
<tr>
<td>
eight floor
</td>
</tr>
<tr>
<td>
seven floor
</td>
</tr>
<tr>
<td>
sixth floor
</td>
</tr>
<tr>
<td>
fifth floor
</td>
</tr>
<tr>
<td>
forth floor
</td>
</tr>
<tr>
<td>
third floor
</td>
</tr>
<tr>
<td>
second floor
</td>
</tr>
<tr>
<td>
first floor
</td>
</tr>
</table>
</div>
<div class="down">
Copyright &copy福建省五维智讯电气有限公司版权所有&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
<a>技术支持:Honeywell</a>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
<a >联系我们</a><br/>
当前时间:
<script type="text/javascript">
document.write(Date())
</script>
</div>
</div>
</body>
</html>html,body {
margin: 0px;
widty: 100%;
height: 100%;
}#bg {
width: 100%;
height: 15%;
MARGIN: 0px auto;
background-color: blue;
}.company {
width: 20%;
height: 100%;
background-color: fuchsia;
float: left;
margin: 0 auto;
}.menucenter {
width: 20%;
height: 100%;
float: left;
margin: 0 auto;
background-color: green;
}.buts {
height: 100%;
width: 100%;
margin: 0 auto;
background-color: yellow;
}.buttons {
position: absolute;
top: 2%;
margin: 0 auto;
}.times {
position: absolute;
margin: 0 auto;
top: 1%;
right: 2%;
}.cent {
width: 100%;
height: 95%;
margin-top: 2px;
margin: 0 auto;
}.bgimg0 {
position: absolute;
left: 5%;
width: 95%;
height: 86%;
background-color: orange;
margin: 0 auto;
}
.bgimg1{
position: absolute;
left: 5%;
width: 95%;
height: 86%;
background-color: silver;
margin: 0 auto;
}
.bgimg2{
position: absolute;
left: 5%;
width: 95%;
height: 86%;
background-color: black;
margin: 0 auto;
}.floor {
position: absolute;
left: 70%;
top: 30%;
background-color: blue;
border: 2px solid green;
margin: 0 auto;
}.down {
position: absolute;
bottom: -2%;
left: 5%;
width: 100%;
max-height: 15px;
margin: 0 auto;
}
当我点击右上角的图标按钮的时候想要在主页背景图片那个div里面切换场景怎么动不了,帮小弟看看

解决方案 »

  1.   

    function Jump(j){
    for(i=0; i <2; i++) {  
      document.getElementById("bgs" + i).className="bgimg" + i;  
      if( i==j )   
      document.getElementById( "bgs" + i).style.display="block";  
      else   
      document.getElementById( "bgs" + i).style.display="none";  
      }  
    }bgi换为bgs,在js模块也看到这个贴