导航条的一个偏移样式,在IE下可以作用。
到了FF下面没效果,请问该怎么写?

解决方案 »

  1.   


                if(Nav()=='IE') {
    document.getElementById(cid).style.display = "block";
    document.getElementById(cid).style.paddingLeft = padding;
    }
                   else if (Nav() == 'FF') {
       document.getElementById(cid).style.display = "table-row";
       document.getElementById(cid).style.paddingLeft = padding;//这里的偏移无效果!
       }
      

  2.   

    FF下的 padding-left 有其他写法吗?
    搜了半天没搜到
      

  3.   

    if(Nav()=='IE') {
                    document.getElementById(cid).style.display = "block";
                    document.getElementById(cid).style.paddingLeft = "???";
                }
                   else if (Nav() == 'FF')    {
                       document.getElementById(cid).style.display = "table-row";
                       document.getElementById(cid).style.paddingLeft = "???";//这里的偏移无效果!
                   }
    问号的地方应该是一个值吧?
      

  4.   

    把html也贴出来有些标签加paddingLeft是没效果的
      

  5.   

    我没说清楚  
    function (padding) padding  就是个变量
      

  6.   

    ff下需要加"px"
    如document.getElementById(cid).style.paddingLeft = padding+"px";
      

  7.   


    //一级菜单
    ><A class=sclink id=sclink10 onMouseOver="expandcontent('sc10', this,2,780)" href="#">联系我们</A>//二级菜单
       <DIV class=tabcontent id=sc10>
                <dd class="kuai"> </dd>
                  <dd class="kuai1"> <A href="#">申请加入</A><A href="#">申请加入</A></dd>
                  <dd class="kuai2"> </dd>
                 </DIV>//二级菜单偏移的JS
          function expandcontent(cid, outNum,inPadding)
            { //padding
    var padding = outPadding(cid,outNum,inPadding);

                if (previoustab != ""){
                    document.getElementById(previoustab).style.display = "none";
                }
                if(Nav()=='IE') {
    document.getElementById(cid).style.display = "block";
    document.getElementById(cid).style.paddingLeft = padding;
    }
                   else {
       document.getElementById(cid).style.display = "table-row";
       document.getElementById(cid).style.marginLeft = padding;
       }
      

  8.   


    function outPadding(cid,outNum,inPadding){
    //子栏目数量
    var anum = document.getElementById(cid).getElementsByTagName('a').length;
    var onePad = 100;
    if (anum > outNum && inPadding > onePad){
    inPadding -= (anum - outNum) * onePad;
    inPadding = (inPadding < 0) ? 0 : inPadding;
    }
                            //px....不是这个原因,就是FF的原因,我想在想知道的是FF下面PADDING-LEFT是否有其他写法
    inPadding += 'px';
    return  inPadding;
    }
      

  9.   

    没有吧,paddingLeft是标准写法
      

  10.   

    function ff() {
                //            var key = o.value.replace("'", "\'");
                //            alert(key);
                //            //t = setTimeout("b('" + key + "')", 1000);            if (window.navigator.appName == 'Microsoft Internet Explorer') {
                    document.getElementById("div2").style.display = "block";
                    document.getElementById("div2").style.paddingLeft = "20px";
                }
                else {
                document.getElementById("div2").style.display = "block";
                document.getElementById("div2").style.paddingLeft = "20px"; //这里的偏移无效果!
                }        }
      

  11.   

    我自己试了一下,是 table-row样式的问题
    如果用这个样式的话
    padding没效果
    改成 block 可以了
      

  12.   

    如果时候Firefox的话,后面加一个20px !important!
    例如:
    padding-left:20px !important  /*非IE浏览器的*/ 
    padding-left:10px;/*IE浏览器*/ 
      

  13.   


    是的  是 TABLE-ROW 影响的
    非IE的样式用BLOCK就好了
    不太理解TABLE-ROW的用法,就直接改了。。
      

  14.   

    谢谢
    CSS的话,我知道应该这么写
      

  15.   

    !important不要乱用,ie7以上已经支持了,用了后悔死你