zoukankan      html  css  js  c++  java
  • 常用

    JSON:[{"name":"yldk","type":"111","value":"111"}]
    json对象转换为字符串:  JSON.stringify(json);
    字符串转换为json对象:  JSON.parse(str);

    ==============================================================================

    Jquery遍历数组和对象
    $.each(array, function (index, perObj) { //遍历数组 perObj:是对象

      //遍历对象
      for (var key in perObj) {
         // 获取key和value
        var curKey = key;
        var curValue = perObj[key];
      }
    });

    遍历dom
    $(".dom").each(function(index,perObj){})
    遍历数组
    $.each(array,function(index,perObj){})

    return false==break  跳出整个each循环

    return true==continue  跳出单层循环

    ===========================================================================================

    表单相关:

    radio设置和移除选中项
    $dom.find('input[name="kaicangOption"]').removeAttr("checked"); //移除选中项
    $dom.find('input[name="kaicangOption"]).attr("checked", "checked"); //设置选中项

    设置select下拉框是否可用
    $dom.find('select').attr('disabled', false); //可用
    $dom.find('select').attr('disabled', true); //不可用

    select下拉框:
    $("#mySelect").val(); //获取选中记录的value值
    $("#mySelect option:selected").text(); //获取选中记录的text值

    ==============================================================================

    Jquery截取字符串 多余显示...
    var get_txt = perObj.summary;
    var original_txt = get_txt ? get_txt : "";
    var brief_txt = original_txt.length > 99 ? original_txt.substr(0, 100) + '....' : original_txt;

    ==============================================================================

    判断浏览器IE8浏览器
    var isIE = !!window.ActiveXObject;
    var isIE6 = isIE && !window.XMLHttpRequest;
    var isIE8 = isIE && !!document.documentMode;
    var isIE7 = isIE && !isIE6 && !isIE8;
    if (isIE8) {
      $(".centerArea .rightArea").css("width", "987px");
    }

    ==============================================================================

    /*如果浏览器不支持渐变,使用图像作为背景 */
    background: url("/skin/jpkecheng/images/jinjieLuTiYan/btnAction.png") 0px 0px no-repeat;
    /* Webkit: Safari 4-5, Chrome 1-9 */
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fffdf7), to(#f4bebe));
    /* Webkit: Safari 5.1+, Chrome 10+ */
    background: -webkit-linear-gradient(top, #fffdf7, #f4bebe);
    /* Firefox 3.6+ */
    background: -moz-linear-gradient(top, #fffdf7, #f4bebe);
    /* Opera 11.10+ */
    background: -o-linear-gradient(top, #fffdf7, #f4bebe);
    /* IE 10 */
    background: -ms-linear-gradient(top, #fffdf7, #f4bebe);
    ///* IE < 10 */
    filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#fffdf7',endColorStr='#f4bebe');

    ===============================================================================

    CSS3相关:

    设置transition
    transition: 0.3s all;
    -webkit-transition: 0.3s all;
    -moz-transition: 0.3s all;

    设置box-sizing
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;

    内阴影 第一个参数inset
    box-shadow: 0px 0px 30px 0px #afafaf;
    -moz-box-shadow: 0px 0px 30px 0px #afafaf;
    -webkit-box-shadow: 0px 0px 30px 0px #afafaf;

    默认是外阴影
    box-shadow: 5px 5px 20px #ff0000;
    -webkit-box-shadow: 5px 5px 20px #ff0000;
    -moz-box-shadow: 5px 5px 20px #ff0000;
    filter: progid: DXImageTransform.Microsoft.Shadow(color='#ff0000', Direction=135, Strength=5);

    ================================================================================

    设置滚动条的样式
    .List::-webkit-scrollbar {
    10px;
    height: 10px;
    background-color: #F5F5F5;
    }
    .List::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    background-color: #F5F5F5;
    }
    .List::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
    background-color: #DAD9D9;
    }

    ================================================================================

    去除所有空格
    $('.username').val().trim().replace(/[ ]/g, "");

    ===============================================================================

    enter按钮键触发
    $('#queryform').keydown(function (e) {
      if (e.keyCode == 13) {
        $("#query").trigger("click");
      }
    });

    ==============================================================================

    UeEditor编辑器


    获取编辑器的内容
    var pContent = UE.getEditor("pContent").getContent();
    清空编辑器内容
    var editorBox = UE.getEditor('pContent');
    editorBox.setContent('');
    赋值编辑器(//编辑器初始化完成再赋值)
    var editorBox = UE.getEditor('pContent');
    editorBox.ready(function () {
    editorBox.setContent(contInfo);
    });

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

    ===============================================================================

     

     

    ===============================================================================

  • 相关阅读:
    《C++ Primer》之面向对象编程(四)
    《C++ Primer》之面向对象编程(三)
    《C++ Primer》之面向对象编程(二)
    《C++ Primer》之面向对象编程(一)
    《C++ Primer》之指向函数的指针
    C++ 隐式类类型转换和转换操作符
    python中的sum函数.sum(axis=1)
    numpy中tile函数
    sscanf函数详解
    snprintf()返回值的陷阱
  • 原文地址:https://www.cnblogs.com/songxia/p/10288737.html
Copyright © 2011-2022 走看看