• 1
  • 2
  • 3
  • 4

提供一组网站优化代码

发表时间:2009-1-17 3:4:38   文章归类:网站优化

   这里提供一组网站优化代码,以供那些做网站优化的人一些参考,先声明,仅仅提供参考.

   /* 二级onmouseover的字体颜色、背景色*/
}
/*==============================*/
#nav tr:hover ul {
left: auto;
}
#nav tr.sfhover ul {
left: auto;
}
#content {
clear: left;
}
#nav tr.collapsed {
display: none;
}
-->
#PARENT{
width:300px;
padding-left:20px;
}
</style>
<table width="182" border="0" cellpadding="0" cellspacing="0" id="nav">
<tr>
    <td background="images/Tem_13.gif" height="34"><a href="#Menu=Nav1" onclick="DoMenu('Nav1');">11111111</a></td>
</tr>
<tr>
    <td height="1"></td>
</tr>
<tr id="Nav1" class="collapsed">
    <td>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>
   </table></td>
</tr>
<tr>
    <td background="images/Tem_13.gif" height="34"><a href="#Menu=Nav2" onclick="DoMenu('Nav2');">222222222222</a></td>
</tr>
<tr>
    <td height="1"></td>
</tr>
<tr id="Nav2" class="collapsed">
    <td>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>
   </table></td>
</tr>
<tr>
    <td background="images/Tem_13.gif" height="34"><a href="#Menu=Nav3" onclick="DoMenu('Nav3');">333333333</a></td>
</tr>
<tr>
    <td height="1"></td>
</tr>
<tr id="Nav3" class="collapsed">
    <td>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>
   </table></td>
</tr>
<tr>
    <td background="images/Tem_13.gif" height="34"><a href="#Menu=Nav4" onclick="DoMenu('Nav4');">444444444444</a></td>
</tr>
<tr>
    <td height="1"></td>
</tr>
<tr id="Nav4" class="collapsed">
    <td>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>
   </table></td>
</tr>
<tr>
    <td background="images/Tem_13.gif" height="34"><a href="#Menu=Nav5" onclick="DoMenu('Nav5');">55555555555</a></td>
</tr>
<tr>
    <td height="1"></td>
</tr>
<tr id="Nav5" class="collapsed">
    <td>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>
   </table></td>
</tr>
<tr>
    <td background="images/Tem_13.gif" height="34"><a href="#Menu=Nav6" onclick="DoMenu('Nav6');">6666666666</a></td>
</tr>
<tr>
    <td height="1"></td>
</tr>
<tr id="Nav6" class="collapsed">
    <td>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>
   </table></td>
</tr>
<tr>
    <td background="images/Tem_13.gif" height="34" id="foldheader"><a href="#Menu=Nav7" onclick="DoMenu('Nav7');">77777777777</a></td>
</tr>
<tr>
    <td height="1"></td>
</tr>
<tr id="Nav7" class="collapsed">
    <td>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>   
    <tr>
    <td background="images/Tem_16.gif" height="34">&nbsp;</td>
    </tr>
    <tr>
    <td height="1"></td>
    </tr>
   </table></td>
</tr>
</table>
<script type=text/javascript><!--
var LastLeftID = "";
function menuFix() {
var obj = document.getElementById("nav").getElementsByTagName("tr");
for (var i=0; i<obj.length; i++) {
obj[i].onmouseover=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
obj[i].onMouseDown=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
obj[i].onMouseUp=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
obj[i].onmouseout=function() {
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
}
}
}
function DoMenu(emid)
{
var obj = document.getElementById(emid);
obj.className = (obj.className.toLowerCase() == "expanded"?"collapsed":"expanded");
if((LastLeftID!="")&&(emid!=LastLeftID)) //关闭上一个Menu
{
document.getElementById(LastLeftID).className = "collapsed";
}
LastLeftID = emid;
}
function GetMenuID()
{
var MenuID="";
var _paramStr = new String(window.location.href);
var _sharpPos = _paramStr.indexOf("#");
if (_sharpPos >= 0 && _sharpPos < _paramStr.length - 1)
{
_paramStr = _paramStr.substring(_sharpPos + 1, _paramStr.length);
}
else
{
_paramStr = "";
}
if (_paramStr.length > 0)
{
var _paramArr = _paramStr.split("&");
if (_paramArr.length>0)
{
var _paramKeyVal = _paramArr[0].split("=");
if (_paramKeyVal.length>0)
{

可刷新的Div+CSS+JS制作的树型菜单
<style type="text/css">
<!--
*{margin:0;padding:0;border:0;}
body {
font-family: arial, 宋体, serif;
font-size:12px;
}
#nav {
width:180px;
line-height: 24px;
list-style-type: none;
text-align:left;
/*定义整个ul菜单的行高和背景色*/
}
/*==================一级目录===================*/
#nav a {
width: 160px;
display: block;
padding-left:20px;
/*Width(一定要),否则下面的Li会变形*/
}
#nav li {
background:#CCC; /*一级目录的背景色*/
border-bottom:#FFF 1px solid; /*下面的一条白边*/
float:left;
/*float:left,本不应该设置,但由于在Firefox不能正常显示
继承Nav的width,限制宽度,li自动向下延伸*/
}
#nav tr a:hover{
background:#CC0000; /*一级目录onMouseOver显示的背景色*/
}
#nav a:link {
color:#666; text-decoration:none;
}
#nav a:visited {
color:#666;text-decoration:none;
}
#nav a:hover {
color:#FFF;text-decoration:none;font-weight:bold;
}
/*==================二级目录===================*/
#nav tr ul {
list-style:none;
text-align:left;
}
#nav tr ul tr{
background: #EBEBEB; /*二级目录的背景色*/
}
#nav tr ul a{
padding-left:20px;
width:160px;
/* padding-left二级目录中文字向右移动,但Width必须重新设置=(总宽度-padding-left)*/
}

 

(推荐阅读:404错误返回302和200代码原因及解决
(推荐阅读:网站垃圾代码简介
(推荐阅读:网页代码表格减肥工具
(推荐阅读:CSS经典代码
(推荐阅读:Alexa排名代码


  本文系原创文章,版权归为深圳网站优化所有,原文请查看链接地址http://www.baidu-seo.net.cn/seo-site/200/,转载必须带上此地址,并标明原始出处,否则将追究法律责任。

Tags: 如何网站优化   代码  

©2007-2021 龙阳网络(www.baidu-seo.net.cn) 版权所有 闽ICP备14017888号-2