<script type="text/javascript">
function wenben() {
var inputdiv=document.getElementById("input22").value;
var aa=inputdiv.replace(/^[s? ]+|[s? ]+$/g,"");
alert("stat-"+aa+"-end");
return false;
}
</script>
<input type="text" id="input22" />
<input type="button" οnclick="return wenben()" value="去掉两端空格" />
function wenben() {
var inputdiv=document.getElementById("input22").value;
var aa=inputdiv.replace(/^[s? ]+|[s? ]+$/g,"");
alert("stat-"+aa+"-end");
return false;
}
</script>
<input type="text" id="input22" />
<input type="button" οnclick="return wenben()" value="去掉两端空格" />