一些前端开发实用的函数—1(jquery)

To be myself, forever

获取src后面的参数

function getURLParameter(name) {
   var param = decodeURIComponent((new RegExp('[?|&]' + name +          '=' + '([^&;]+?)  (&|#|;|$)').exec(location.search) || [ , "" ])[1]
                .replace(/\+/g, '%20'))
                || null;
        return param == "undefined" ? "--" : param;
    }
    alert(getURLParameter("ZD_WorkBillID"));

重载iframe

window.frames["Main"].location.reload();

将undefined转换成”“

function undefinedProcess(data,changeVal)
{
    var retRuelst="";
    if(data==undefined||(data+"")==''||data==null||data=='undefined'){
        retRuelst=changeVal;
    }else{
        retRuelst=data;
    }
    return retRuelst;
}

显示iframe里面的元素

var ifr = document.getElementById("left");
ifr.contentWindow.$("#customplan").show();

取字符串前10个

var LG_LoanDate=rptdata.data[i].LG_LoanDate.substr(0,10);

在src后拼参数

$("#daizhangyuanyin_a").attr("href","../../view/zcgl/daizhangyuanyin.jsp?ZI_ApplyBillID="+ZI_ApplyBillID+"&"+"checktype="+checktype+"&"+"ZI_WriteOffBillID="+ZI_WriteOffBillID);

下拉框

$("#selectbutton1r").find("option:selected").val();

还原下拉框

mytable=$("#new_dataCustom")[0];
numone=obj.parentNode.parentNode.rowIndex;

var select=document.getElementById("sex");
var index=select.selectedIndex//当前坐标
var option=select.options[index];
if(mytable.rows[numone].cells[2].innerHTML==""){
   select.options[0].selected=true;
}else{
   option.text=mytable.rows[numone].cells[2].innerHTML;
}

导航(head)

$(obj).addClass("changePage");
$(obj).siblings("li").each(function() {
            $(this).removeClass();
        });

返回

function onback(){
    history.back();
    }

拼id

id='"+rptdata.data[i].ZI_ApplyBillID+"_"+rptdata.data[i].ZI_WriteOffBillID+"'
ZI_WriteOffBillID_str=this.id.split("_")[1];
id='remark_"+(i+1)+"' 
var SD_Remak=$("#remark_"+id).val();

清除a标签的焦点

a.hidefocus {outline: none;}
<a class="hidefocus" hidefocus href="../../view/bbgl/baseinfo.jsp" id="baseinfo2" target="infoInput">
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值