利用css背景图片与表格 切换的效果

本文介绍了一种使用HTML和JavaScript实现的页面切换效果。通过简单的背景图片与表格内容的切换,展示了如何利用JavaScript来控制不同内容的显示与隐藏,同时保持页面元素状态的一致性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> 背景图片与表格 切换的效果 </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<link href="images/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.tableborder {
  border-top-width: 1px;
 border-right-width: 1px;
 border-bottom-width: 1px;
 border-left-width: 1px;
 border-top-style: solid;
 border-right-style: solid;
 border-bottom-style: solid;
 border-left-style: solid;
 border-top-color: #B5B5B5;
 border-right-color: #B5B5B5;
 border-bottom-color: #B5B5B5;
 border-left-color: #B5B5B5;
 }
.Layer1 {
 BACKGROUND: url(images/20070817-01.gif);
 background-repeat: no-repeat;
}
.Layer1-1 {
 BACKGROUND: url(images/20070817-00.gif);
 background-repeat: no-repeat;
}
-->
</style>
<script language="javascript" type="text/javascript">
var id=null;
function nav_click(obj){
   if(id!=null){
   document.getElementById(id).className="Layer1";
   }
   id=obj;
   document.getElementById(id).className="Layer1-1";
}
</script>
<SCRIPT language=JavaScript>
<!--
function tabit(cname,divid,btnid,sname){

if(btnid == "a"){
   document.getElementById(divid+"b").style.display = "none";
   document.getElementById(divid+"c").style.display = "none";
   document.getElementById(cname).className = "btn01a";
}
else if(btnid == "c"){
   document.getElementById(divid+"b").style.display = "none";
   document.getElementById(divid+"a").style.display = "none";
   document.getElementById(cname).className = "btn01c";
}
else{
   document.getElementById(divid+"a").style.display = "none";
   document.getElementById(divid+"c").style.display = "none";
   document.getElementById(cname).className = "btn01b";
}
document.getElementById(divid+btnid).style.display = "";

}
//-->
</SCRIPT>

</HEAD>

<BODY>
<table width="778" border="0" cellpadding="0" cellspacing="0"  align="center" bgcolor="#F5F5F5">
  <tr>
    <td id=btn01>
 <table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="104" height="26" align="center" id="one" onclick="nav_click('one');tabit('btn01','div1','a')"  class="Layer1"><A title="" href="javascript:void(0)">1111</a></td>
        <td align="center" width="104"  id="two" onclick="nav_click('two');tabit('btn01','div1','b')"  class="Layer1"><A title="" href="javascript:void(0)">2222</a></td>
        <td align="center" width="104" id="three" onclick="nav_click('three');tabit('btn01','div1','c')"  class="Layer1"><A title="" href="javascript:void(0)">3333</a></td>
      </tr>
    </table>
 </td>
  </tr>
  <tr>
    <td height="140" valign="top">
      <table width="100%" border="0" cellpadding="4" cellspacing="0" class="tableborder" id=div1a >
        <tr>
          <td height="4" bgcolor="#EAE8E7"></td>
        </tr>
        <tr>
          <td height="100" valign="top" bgcolor="#ffffff">aaaaaaaaaa</td>
        </tr>
      </table>

          <table width="100%" border="0" cellpadding="4" cellspacing="0" class="tableborder" id=div1b style="DISPLAY: none">
            <tr>
              <td height="4" bgcolor="#EAE8E7"></td>
            </tr>
            <tr>
              <td height="100" valign="top" bgcolor="#ffffff">bbbbbbbbbbbbb</td>
            </tr>
          </table>

          <table width="100%" border="0" cellpadding="4" cellspacing="0" class="tableborder" id=div1c style="DISPLAY: none" >
            <tr>
              <td height="4" bgcolor="#EAE8E7"></td>
            </tr>
            <tr>
              <td height="100" valign="top" bgcolor="#ffffff">ccccccccccccc</td>
            </tr>
          </table>
    </td>
  </tr>
</table>
</BODY>
</HTML>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值