实时统计输入的文字
<body>
<input type="input"/><span></span>
<script>
var oT=document.querySelector('input');
var oS=document.querySelector('span');
if(window.navigator.userAgent.toLowerCase().indexOf('msie 9.0') !=-1){
var timer=null;
oT.onfocus=function(){
timer=setInterval(function(){
oS.innerHTML=oT.value.length;
})
}
oT.onblur=function(){
clearInterval(timer);
}
}else{
oT.oninput=oT.propertychange=function(){
oS.innerHTML=oT.value.length
};
}
</script>
</body>