• 小问题总结


    1. IE下中文乱码处理
      URL中含有汉字时,IE不会自动转为UTF8编码。必须自己手动用js的encodeURI或@iSea  提到的函数转码为UTF8格式之后,再拼接你要post的URL。这样服务器端处理时得到的就UTF8编码,而不是乱码。代码调整如下即可:

      var menuName = encodeURI($("#menuName").val())

    2. 后台处理乱码(针对不同浏览器)
      String fileName = request.getParameter("fileName");// 解决中文文件名乱码问题
      if (request.getHeader("User-Agent").toLowerCase().indexOf("firefox") > 0) {
         fname = new String(fileName.getBytes("UTF-8"), "ISO8859-1"); // firefox浏览器
      } else if (request.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0) {
          fname = URLEncoder.encode(fileName, "UTF-8");// IE浏览器
      }else if (request.getHeader("User-Agent").toUpperCase().indexOf("CHROME") > 0) {
          fname = new String(fileName.getBytes("UTF-8"), "ISO8859-1");// 谷歌
      }
    3. 从页面向后台传递#号
        var  param =encodeURIComponent("abc#xyz");  //前台处理、传值
        window.location="some_web_project/xxx.jsp?param=" + param;
      
        String param =request.getParameter("param");  //后台取值
    4. ftl页面对小数的处理
      value="<@s.property value='credit.outPolicyArea'/>"
    5. 一个table 有多个td 某一列为text类型的input 要求填满(类似文本域)
      $(function(){
          $("#dqtable td :text").height(function(){
          return $(this).parents("td").height();
          })
      });
    6. text类型的input 点击事件置空且只读
      // 1.使用$('#id').val("")方法;
      $('.isPass').click(function(){
          if($(this).val() == '1' && $(this).prop("checked") == true){
              $('#hpPifu1').val("");
              $('#hpPifu2').val("");
              $('#hpPifu1').prop("disabled",true);
              $('#hpPifu2').prop("disabled",true);
          }else{
              $('#hpPifu1').prop("disabled",false);
              $('#hpPifu2').prop("disabled",false);
          }
      });        
      
      //2.若有form包裹
      $('#formid').form('clear');
  • 相关阅读:
    20160205
    20151120
    20151023
    20151023
    20140207
    yum工具介绍
    Linux程序包管理
    Linux任务计划、周期性任务执行
    10 压缩和解压缩工具和bash脚本编程
    9 btrfs文件系统
  • 原文地址:https://www.cnblogs.com/sxxjyj/p/6208614.html
Copyright © 2020-2023  润新知