JSP代码
StringObject.replaceAll('替换前字符串','替换后字符串')
StringObject.replaceAll('//+','') //替换+号为空
StringObject.replaceAll('//<','') //替换<号为空
StringObject.replaceAll('//>','') //替换>号为空
StringObject.replaceAll('"//<%%OrderId%%//>",OrderId) //替换<%%OrderId%%>%号为变量OrderId的值
JS脚本代码
<script language="Javascript">
function qCheck(){
q = document.jspForm.q.value;
alert(q);
q = replaceAll(q," ","");
alert(q);
document.jspForm.q.value = q;
}
function (strOrg,strFind,strReplace){
var index = 0;
while(strOrg.indexOf(strFind,index) != -1){
strOrg = strOrg.replace(strFind,strReplace);
index = strOrg.indexOf(strFind,index);
}
return strOrg
}
</script>