其他分享
首页 > 其他分享> > js常用的语句

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();");//添加事件

     

标签:语句,function,常用,retStatus,layer,js,window,data,errMsg
来源: https://www.cnblogs.com/gjq1126-web/p/11224058.html