zoukankan      html  css  js  c++  java
  • 点击箭头 隐藏/展开 左侧导航

    一、确保左侧导航div固定宽度,右侧内容div不设置宽度

    二、在左侧内容div  和 右侧内容 div 中间 添加如下代码:

       <div style="10px; float:left; ">  

          <table>  

             <tr><td height="200px"></td></tr>

            <tr><td><img id="img_arrow" src="/images/arrow_left.jpg" onclick="usr()"/></td></tr>  

          </table>

    </div>

       <script>  

    function usr()  {  

        var img_arrow= document.getElementById("img_arrow");  

        if(img_arrow.src.indexOf("arrow_left") >= 0)    {      

         //收缩   arrow_left 左向箭头名称,arrow_right 右向箭头名称

         img_arrow.src=img_arrow.src.replace("arrow_left","arrow_right");      //   切换箭头图片

         document.getElementById("s4-leftpanel").style.display="none";          // 隐藏左侧导航

         document.getElementById("MSO_ContentTable").style["margin-Left"]="10px";       //   修改、减小右侧导航margin-Left,箭头图片宽度为10px

        }  

    else    {  

           //展开

           img_arrow.src=img_arrow.src.replace("arrow_right","arrow_left");     

           document.getElementById("s4-leftpanel").style.display="block";    

           document.getElementById("MSO_ContentTable").style["margin-Left"]="203px";

         }

      }    

    </script>

     

  • 相关阅读:
    Servlet文件上传下载
    通过jquery将多选框变单选框
    Java 浮点数精度控制
    JS实现点击table中任意元素选中
    SpringMVC-时间类型转换
    SpringMVC--提交表单
    路径 专题
    防盗链
    Request
    RequestResponse简介
  • 原文地址:https://www.cnblogs.com/mySaveblogs/p/3981351.html
Copyright © 2011-2022 走看看