利用js跨页面保存变量做菜单的方法(2)

switch(d_id){
   case 1:
    history.dmenu=1;
    break;
   case 2:
    history.dmenu=2;
    break;
   case 3:
    history.dmenu=3;
    break;
   case 4:
    history.dmenu=4;
    break;
   case 5:
    history.dmenu=5;
    break;
   case 6:
    history.dmenu=6;
    break;
  }
 }
 //按下相关图片按钮后设置history.dmenu为相应的值从而在页面加载时能根据这个值来进行图片的变换

//-->
</script>
<table cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="4"><table cellpadding="0" cellspacing="0">
      <tr>
        <td rowspan="2"><img src="https://www.jb51.net/images/LOGO.gif" /></td>
        <td>&nbsp;</td>
        <td valign="middle"><a href="#"><img src="https://www.jb51.net/images/anA1.gif" /></a></td>
        <td valign="middle"><a href="#"><img src="https://www.jb51.net/images/anA2.gif" /></a></td>
        <td valign="middle"><strong><a href="#"><img src="https://www.jb51.net/images/anA3.gif" /></a></strong></td>
        <td valign="middle"><a href="#"><img src="https://www.jb51.net/images/anA4.gif" /></a></td>
        <td valign="middle">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="6">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="4"><table cellpadding="0" cellspacing="0">
      <tr>
        <td><a href="https://www.jb51.net/"><img src="https://www.jb51.net/images/anB1.gif"/></a></td>
        <td><a href="https://www.jb51.net/order/"><img src="https://www.jb51.net/images/anB2.gif" /></a></td>
        <td><a href="https://www.jb51.net/news/"><img src="https://www.jb51.net/images/anB3.gif"/></a></td>
          <td><a href="https://www.jb51.net/law/"><img src="https://www.jb51.net/images/anB6.gif" /></a></td>
  <td><a href="https://www.jb51.net/exhibit/"><img src="https://www.jb51.net/images/anB4.gif"/></a></td>
        <td><a href="https://www.jb51.net/company/"><img src="https://www.jb51.net/images/anB5.gif"/></a></td>
        <td background="/images/bjB1.gif">&nbsp;</td>
        <td><img src="https://www.jb51.net/images/tuB1.gif" /></td>
      </tr>
      <tr>
        <td colspan="7"><table cellpadding="0" cellspacing="0" background="/images/bjB2.gif">
          <tr>
            <td>&nbsp;</td>
            <td><img src="https://www.jb51.net/images/tuB4.gif" /></td>
            <td><span></span></td>
            <td><input type="text" size="40" /></td>
            <td><select>
              <option value="0">Please Select</option>
              <option value="1">News</option>
              <option value="2">Exhibit</option>
              <option value="3">Company</option>
            </select></td>
            <td><a href="#"><img src="https://www.jb51.net/images/tuB5.gif" /></a></td>
            <td valign="middle"><img src="https://www.jb51.net/images/tuB6.gif" />&nbsp;&nbsp;<a href="javascript:void(0)">站内搜索</a></td>
            <td>&nbsp;</td>
          </tr>

        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><img src="https://www.jb51.net/images/tuB2.gif" /></td>
    <td background="/images/bjB3.gif"><strong>公告</strong></td>
    <td background="/images/bjB3.gif"><a href="#"> to trash cans, find the Public Utility Equipment </a><span>new!</span><br /></td>
    <td ><img src="https://www.jb51.net/images/tuB3.gif" /></td>
  </tr>
</table>
<script language="javascript">
init();   //这里注意一定要写在这里,要不然这个初始化函数就会报错说找不到对像
</script>

 

这种的效果如下:

先看首页:

利用js跨页面保存变量做菜单的方法

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjgzjp.html