本帖最后由 feifeiwu 于 2009-12-08 22:32:10 编辑

解决方案 »

  1.   

    支持w3c标准可能一些方法和属性不支持 那段引用的js代码呢?上面看不出来什么问题 
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    去掉看能不能正常显示
      

  3.   

    回3#楼:
    1、引用的js代码如下:
    var imgwidth=700;
    function $(id){return document.getElementById(id);}
    function show(o){document.getElementById(o).style.display="block";}
    function hide(o){document.getElementById(o).style.display="none";}
    function geturl(url,id){
    var http=false;
    $(id).innerHTML='<span class="loading">&nbsp;&nbsp;</span>';
    if(window.XMLHttpRequest){http=new XMLHttpRequest();if(http.overrideMimeType){http.overrideMimeType('text/plain');}}else if(window.ActiveXObject){try{http=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
    if(!http){alert('Cannot send an XMLHTTP request');return false;}
    http.onreadystatechange=function(){if(http.readyState==4){$(id).innerHTML=http.responseText;}}
    http.open("get", url, true);
    http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    http.send(null);
    }
    function imgsize(){
    var img=document.getElementById("content").getElementsByTagName("img");
    for(var i=0; i<img.length;i++){
    if(img[i].width>imgwidth){img[i].width=imgwidth;img[i].style.width=imgwidth;img[i].title="View";img[i].style.cursor="pointer";img[i].border=0;img[i].onclick=function(e){window.open(this.src);}}
    }
    }2、去掉<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  之后,菜单效果确实没问题,但是整个页面居左对齐,而不是按照DIV+CSS控制的居中对齐。
      

  4.   

    菜单部分的CSS如下:
    *{margin:0;padding:0;border:0;}
    /* body{font-family:arial,宋体,serif;font-size:12px;}*/
    #nav{width:1000px;height:43px;margin:0px; padding:0px;line-height:35px;list-style-type:none;background:url(/Images/Site_Navi_Bg1.gif) repeat-x;}#nav a{display:block;width:80px;text-align:center;}
    #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 li{float:left;width:80px;}
    #nav li a:hover{background:#999;}
    #nav li ul{margin:0px;line-height:35px;list-style-type:none;text-align:left;left:-999em;width:180px;position:absolute;}
    #nav li ul li{float:left;width:180px;background:#F6F6F6;}
    #nav li ul a{display:block;width:156px;text-align:left;padding-left:24px;}
    #nav li ul a:link{color:#666;text-decoration:none;}
    #nav li ul a:visited{color:#666;text-decoration:none;}
    #nav li ul a:hover{color:#F3F3F3;text-decoration:none;font-weight:normal;background:#C00;}
    #nav li:hover ul{left:auto;}
    #nav li.sfhover ul{left:auto;}
    #content{clear:left;}
      

  5.   

    kangfu????哪来的,代码不全,根本跑不起来
      

  6.   

    您好,kangfu用在同一页面的此处:
    <div class="kangfu" style="width:600px;text-align:right; font-size:30px; font-weight:bold; color:#333366">
    已有<span style="color:#CC3333" id=kangfu>11300</span>人通过使用我们的产品得到康复</div>由于页面太长,就把其他部分略去了。
      

  7.   

    也可以把这一段删除:
      i=11200
        function aa()
       {if(i<11300)
        i++
        kangfu.innerText=i}
        setTimeout('setInterval("aa()",1)',10);
      

  8.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>主页</title>
    <meta name="keywords" content="文章"/>
    <meta name="description" content="文章"/>
    <style>
    .wrap *{margin:0;padding:0;border:0;}
    body{padding:0;padding:0;font-family:arial,宋体,serif;font-size:12px;}
    #nav{width:1000px;height:43px;margin:0px; padding:0px;line-height:35px;list-style-type:none;background:url(/Images/Site_Navi_Bg1.gif) repeat-x;}
    #nav a{display:block;width:80px;text-align:center;}
    #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 li{float:left;width:80px;}
    #nav li a:hover{background:#999;}
    #nav li ul{margin:0px;line-height:35px;list-style-type:none;text-align:left;left:-999em;width:180px;position:absolute;}
    #nav li ul li{float:left;width:180px;background:#F6F6F6;}
    #nav li ul a{display:block;width:156px;text-align:left;padding-left:24px;}
    #nav li ul a:link{color:#666;text-decoration:none;}
    #nav li ul a:visited{color:#666;text-decoration:none;}
    #nav li ul a:hover{color:#F3F3F3;text-decoration:none;font-weight:normal;background:#C00;}
    #nav li:hover ul{left:auto;}
    #nav li.sfhover ul{left:auto;}
    #content{clear:left;}
    </style>
    <script type="text/javascript">
    var imgwidth=700;
    function $(id){return document.getElementById(id);}
    function show(o){document.getElementById(o).style.display="block";}
    function hide(o){document.getElementById(o).style.display="none";}
    function geturl(url,id){
    var http=false;
    $(id).innerHTML='<span class="loading">&nbsp;&nbsp;</span>';
    if(window.XMLHttpRequest){http=new XMLHttpRequest();if(http.overrideMimeType){http.overrideMimeType('text/plain');}}else if(window.ActiveXObject){try{http=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
    if(!http){alert('Cannot send an XMLHTTP request');return false;}
    http.onreadystatechange=function(){if(http.readyState==4){$(id).innerHTML=http.responseText;}}
    http.open("get", url, true);
    http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    http.send(null);
    }
    function imgsize(){
        var img=document.getElementById("content").getElementsByTagName("img");
        for(var i=0; i<img.length;i++){
            if(img[i].width>imgwidth){img[i].width=imgwidth;img[i].style.width=imgwidth;img[i].title="View";img[i].style.cursor="pointer";img[i].border=0;img[i].onclick=function(e){window.open(this.src);}}
        }
    }</script><script language="javascript" defer> 
    var i = 11200;
    function aa(){
    if (i<11300) i++;
        //kangfu.innerText=i
    }
    //setTimeout('setInterval("aa()",1)',10);
      
    function menuFix(){
      var sfEls = document.getElementById("nav").getElementsByTagName("li");   
      for(var i=0;i<sfEls.length;i++){
        sfEls[i].onmouseover=function(){
          this.className+=(this.className.length>0 ? " ":"") + "sfhover";
          if(window.event){
             var ul = this.getElementsByTagName("ul")[0];
             if(ul) ul.style.left = "auto";
          }
        } 
        sfEls[i].onMouseDown=function(){   
          this.className+=(this.className.length>0 ? " ":"") + "sfhover";   
        }
        sfEls[i].onMouseUp=function(){   
          this.className+=(this.className.length>0 ? " ":"") + "sfhover";   
        }
        sfEls[i].onmouseout=function(){
          this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");
          if(window.event){
             var to = event.toElement;
             var ul = this.getElementsByTagName("ul")[0];
             if(ul) if(!ul.contains(to)) ul.style.left = "-999em";
          }
        }
      }  
    }
    window.onload = menuFix; 
      </script>  
    </head>
    <body><div class="wrap">
        <!--页头-->
      <div class="head">
        <table width="1000" height="173" border="0" cellpadding="0" cellspacing="0">
          <tr><td><div><img src="/Images/logo.jpg" width="1000" height="173" /></div></td></tr>
        </table>
      </div>    <!--菜单-->
    <div>
        <ul id="nav">
            <li><a href="/" title="">首页</a></li>
            <li><a href="/article/1/" title="产品展示">产品展示</a>
                       <ul>
                            <li><a href='/article/3/' title='Cardio'>Cardio</a></li>
                            <li><a href='/article/2/' title='Angio'>Angio</a></li>
                       </ul>
            </li>
            <li><a href="/article/4/" title="公司新闻">公司新闻</a></li>
            <li><a href="/article/about.html" title="关于我们">关于我们</a></li>
            <li><a href="/article/zhiliang.html" title="质量证明">质量证明</a></li>
            <li><a href="/article/hospital.html" title="骨科医院">骨科医院</a></li>
            <li><a href="/article/hr.html" title="招聘信息">招聘信息</a></li>
            <li><a href="/article/daili.html" title="代理信息">代理信息</a></li>
            <li><a href="/article/huanzhe.html" title="患者信息">患者信息</a></li>
            <li><a href="/article/lianxiwomen.html" title="联系我们">联系我们</a></li>
            <li><a href="/plus/search/" title="本站搜索">本站搜索</a></li>
        </ul>
    <!-- clear the floats if required -->
    <div class="clear:both;"> </div>
    </div></div>
    </body></html>
      

  9.   

    谢谢hookee!
    只是加了两处代码(红色部分),程序就全活了,在ie7及其他浏览器测试通过!很好的解决了页面中!DOCTYPE和js函数function  menuFix()代码之间的冲突bug:
    <script language="javascript" defer> 
    function menuFix(){
      var sfEls = document.getElementById("nav").getElementsByTagName("li");   
      for(var i=0;i<sfEls.length;i++){
        sfEls[i].onmouseover=function(){
          this.className+=(this.className.length>0 ? " ":"") + "sfhover";
          if(window.event){
             var ul = this.getElementsByTagName("ul")[0];
             if(ul) ul.style.left = "auto";
          }

        } 
        sfEls[i].onMouseDown=function(){   
          this.className+=(this.className.length>0 ? " ":"") + "sfhover";   
        }
        sfEls[i].onMouseUp=function(){   
          this.className+=(this.className.length>0 ? " ":"") + "sfhover";   
        }
        sfEls[i].onmouseout=function(){
          this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");
          if(window.event){
             var to = event.toElement;
             var ul = this.getElementsByTagName("ul")[0];
             if(ul) if(!ul.contains(to)) ul.style.left = "-999em";
          }

        }
      }  
    }
    window.onload = menuFix; 
      </script> 再次表示感谢!