//当前页面URL中参数分析函数,正则校验 function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } function zan() { //取得想要的参数值,getQueryString中的参数为String型,传入参数名为URL中参数名,即可获得 var docchannel = getQueryString("docchannel"); var docid = getQueryString("docid"); var xmlhttp; if (window.XMLHttpRequest) {// for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("zanspan").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","./manager/zan+1.jsp?t="+Math.random()+"&docid="+docid+"&docchannel="+docchannel+"",true); xmlhttp.send(); }
时间: 2024-11-05 18:43:00