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

来源:互联网 发布:手机淘宝苹果版本下载 编辑:程序博客网 时间:2024/06/05 17:06

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">
0 0
原创粉丝点击