zoukankan      html  css  js  c++  java
  • 工作中碰到的一些东西

    1.table 隔行换色  table tbody tr{
         background-color: expression(this.sourceIndex%2==0?'#ffffff':'#f5f7f8');
       }

    2. jquery 基本语法:

    <html>
     <head>
     <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
     <script type="text/javascript">
       
      

      $(document).ready(function(){//防止文档在完全加载(就绪)之前运行 jQuery 代码。  

      $("p").click(function(){
         $(this).hide();
       });
       
       $("#modify").click(function(){
        alert("******");
       });
       
      });
     </script>
     </head>
     <body>
       <input type="button" value=" 修改 " id="modify">
       <p>If you click on me, I will disappear.</p>
     </body>
    </html>

    3.选中checkbox

     var modifyCodingId="";
     function modifyInfo(){
     var checkBoxName=document.getElementsByName("IDS");
     var idsStr="";//记录选中的复选框CaremaID
      for(var i = 0;i < checkBoxName.length;i ++){
       if(checkBoxName[i].type.toLowerCase()=="checkbox"){
        if(checkBoxName[i].checked==true){
         if(idsStr==""){
          idsStr = checkBoxName[i].value;
         }else{
          idsStr += "," + checkBoxName[i].value;
         }
        }
       }
      }
     
      if(idsStr.indexOf(",")>0||idsStr==""){
       alert("请选择一条您要修改的记录!");
       return false;
      }else{
       alert("!");
        document.location.href="<%=request.getContextPath() %>/caseListAction.do?method=getAuditInfo&id="+id;
      }
     }
     
      //选中所有的checkbox
     function TotalCheck(){
      var checkBoxName = document.getElementsByName("IDS");
      for(var i = 0;i < checkBoxName.length;i ++){
       if(checkBoxName[i].type.toLowerCase()=="checkbox"){
        if(checkBoxName[i].checked==true){
         checkBoxName[i].checked=false;
        }else{
         checkBoxName[i].checked=true;
        }
       }
      }
     }

    4.js中获取request.getContentPath();

     <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>

    在单独的javascript中不能使用<%= basePath%>类似这样的java  script所以,只能用javascript来获取此context path.
    可以用下面的代码来实现。

    var localObj = window.location;

    var contextPath = localObj.pathname.split("/")[1];

    var basePath = localObj.protocol+"//"+localObj.host+"/"+contextPath;

    var server_context=basePath;

  • 相关阅读:
    寻找完全数(C++)
    莱布尼兹三角形(C++)
    简单的素数问题(C++)
    ubuntu17.04下安装LNMP
    ubuntu下连接mysql出现Access denied for user 'rose'@'localhost' (using password: NO)的解决方法
    快速理解面向对象的PHP编程--基础篇
    百度电面总结
    操作系统基础知识
    快速理解C语言指针
    新手学习MongoDB的基本命令
  • 原文地址:https://www.cnblogs.com/youliang/p/3528781.html
Copyright © 2011-2022 走看看