function GetComment(url,sid,pnum,snum,job) { var Obj=document.getElementById("comment"); if(Obj==null) { alert("页面中不存在id为comment的元素或代码有误"); return false; } var plstr="softid="+sid+"&page="+pnum+"&start="+snum; if(job) { var keyw=''; var plfen=document.getElementById("plfen").value; var plname=document.getElementById("plname").value; var content=document.getElementById("content").value; if(content=='') { alert("请输入评论内容"); return false; } if(strLength("content")>200) { alert("请删减多余的字再提交"); return false; } if(strLength("plname")>20) { alert("称呼者名字太长"); return false; } plname=plname.replace(/(—)/g,"x-A-1-A-A-x"); content=content.replace(/(—)/g,"x-A-1-A-A-x"); plstr+="&plfen="+plfen+"&plname="+encodeURIComponent(plname)+"&content="+encodeURIComponent(content)+"&keyw="+keyw+"&x="+Math.random(); } var Ajax=false; if(window.XMLHttpRequest){ Ajax=new XMLHttpRequest(); if(Ajax.overrideMimeType){ Ajax.overrideMimeType("text/xml"); } } else if(window.ActiveXObject){ try{ Ajax=new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ Ajax=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){} } } if(!Ajax){ alert("不能创建XMLHttpRequest对象实例."); return false; } Ajax.open("POST",url,true); Ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); Ajax.send(plstr); Ajax.onreadystatechange=function(){ if(Ajax.readyState==4) { if(Ajax.status==200) { Obj.innerHTML=Ajax.responseText; } else { Obj.innerHTML='
页面有异常...
'; } } else { if(Obj!=null) { Obj.innerHTML='
没有可显示的内容...
'; } } } } function strLength(Ojb) { var zsLength=0; var i; var plstr=document.getElementById(Ojb).value; var charCode; for(i=0;i=0x0800)&&(charCode<=0xffff)) { zsLength+=2; } } return zsLength; } function plsize() { document.getElementById("plsize").innerHTML=strLength("content"); } function plfen_value(ojb,fen) { var i; document.getElementById('plfen').value=fen; for(i=1;i<=5;i++) { document.getElementById('plfen'+i).checked=0; if(i==fen) ojb.checked=1; } } function ShowPlBox() { document.getElementById('PlBox1').style.display=''; document.getElementById('PlBox2').style.display=''; document.getElementById('PlBox3').style.display=''; } GetComment('../pl/showpl.php',31234,0,0,0);