zoukankan      html  css  js  c++  java
  • 代码杂记(三)

    1

    界面设计中尽量少用粗体.

    还有url中的參数不用再加引號,如:

    method=registProtocol   不能写成method=‘registProtocol’

    2.

    Js获取设置一个元素的位置:

       var div = document.getElementById("minimapDiv");

           div.style.top = div.offsetTop;

           div.style.left = div.offsetLeft;

    jquery获取设置一个元素的位置:

        var div = $("#minimapDiv");

         var top = div.position().top;

         var left = div.offset().left;

          div.css("top",top);

        div.css("left",left);

    3.

    //var agent = window.navigator.appName; //不能用appName进行浏览器推断。由于iechromeappName都是Netscape

     var userAgent = window.navigator.userAgent.toUpperCase();

     if(userAgent.indexOf("CHROME") == -1) { //chrome浏览器

       }else{}

    4.

    Shift+tab:向前缩进(4个字符为准)

    Tab:向后缩进(4个字符为准)

    Ctrl+shift+r:查找

    Ctrl+/:凝视

    Ctrl+d:删除当前行

    Ctrl+alt+:凝视

    Home:行头

    End:行尾

    5.

    java代码设置缓存:

    public static Map<String, Object> cacheMap = new HashMap<String, Object>();//用于缓存已经查询过的字段信息

    if (cacheMap .get(cacheId)!=null) { //缓存中有,则拿取

    return (ProtocolFieldVO)cacheMap .get(cacheId);

    }

    cacheMap.put(cacheId, vo);//缓存中没有,则设置

    6.

    出现:<Could not get the server file lock. Ensure that another server is not running in the same directory. Retrying for another 60 seconds.>

    关掉javaw.exe进程

    7.

    Form表单提交,想要有运行后的提示信息和跳转页面。能够採用:

    response.getWriter().print("
    <script>alert('加入成功');
    <span style="font-family:宋体;">              </span>window.setTimeout(function(){location.href = '/pis/preset/regProtocolMgrAction!getRegistedProtocolInfo.action';},1000);
    </script>");

    假设是ajax或者post请求,就能够在回调函数中alert().







  • 相关阅读:
    centos7下配置时间同步服务器
    交换机简单配置(转)
    ubuntu16.04安装docker CE
    docker下使用DB2
    iptables之centos6版本详解
    iptables之centos6版本常用设置
    iptables介绍iptables和netfilter
    git的使用学习(九)搭建git服务器
    js 图片预览
    ps -ef | grep java 查看所有关于java的进程
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/6707620.html
Copyright © 2011-2022 走看看