js常用的语句

  1. 添加css样式
    $("#txtName").addClass("aa");
    
    ----------------------------------关闭弹窗刷新父页面-----------------------------------
    if(result.retStatus.retCode == 1){
        layer.msg(result.retStatus.errMsg);
        window.setTimeout(function () {window.parent.location.href='query.jhtml'; }, 1000);
        }else{
        layer.msg(result.retStatus.errMsg);
        }
        
        
    success : function(data) {
        var code = data.retStatus.retCode;
        if(code == "1"){
            layer.msg(data.retStatus.errMsg);
            window.parent.location.reload();
            var index = parent.layer.getFrameIndex(window.name); 
            parent.layer.close(index);
            return true;
        }else {
            layer.msg(data.retStatus.errMsg);
            return false;
        }
    }
    
    window.setTimeout(function () {window.location.href='query.jhtml'; }, 1000);
    
    --------------------------------------隐藏框的变化----------------------------------------------------------
    <select name="isPage" id="isPage" lay-filter="isPage">
        <option value="">--请选择--</option>
        <option value="1" <#if channel.isPage?? && channel.isPage == '1' >selected="selected"</#if>>是</option>
        <option value="0" <#if channel.isPage?? && channel.isPage == '0' >selected="selected"</#if>>否</option>
    </select>
    <script>
        layui.use('form', function(){
          var form = layui.form();
          form.on('select(isPage)', function(data){
              console.log(data.value);
              if(data.value=='1'){
                    $("#tr_id").show();
                }else {
                    $("#tr_id").hide();
                }
            });
        });
    </script>
    
    
    --------------------------------------防连击----------------------------------------------------------
    $(".btn-huikuan").removeAttr("onclick");//移除事件
    $(".btn-huikuan").attr("onclick","returnBtn();");//添加事件

     

上一篇:spring事务在实际项目开发中的使用


下一篇:多线程记录文件