<script language=JavaScript>
function strlength(str){
var l=str.length; var n=l;
for (var i=0;i<l;i++){if (str.charCodeAt(i)<0||str.charCodeAt(i)>255) n++;}
return n;
}
function changebyte(value,length){
var l=strlength(value);
if (l<=length) {if (document.all!=null) document.all("byte").innerText="還可以輸入"+(length-l)+"字節";}
else{document.all("byte").innerText="輸入字節數超出范圍";}
return true;
}
function changebyte1(value,length){
var l=strlength(value);
if (l<=length) {if (document.all!=null) document.all("byte1").innerText="還可以輸入"+(length-l)+"字節";}
else{document.all("byte1").innerText="輸入字節數超出范圍";}
return true;
}
function changebyte2(value,length){
var l=strlength(value);
if (l<=length) {if (document.all!=null) document.all("byte2").innerText="還可以輸入"+(length-l)+"字節";}
else{document.all("byte2").innerText="輸入字節數超出范圍";}
return true;
}
</script>
<form method="post" name=test onSubmit="return checkdata()" action="">
<TEXTAREA onkeydown="return changebyte1(document.test.icqcontent.value,20)" onkeyup="return changebyte1(document.test.icqcontent.value,20)" name=icqcontent cols=40 rows="3"></TEXTAREA>
<SPAN id=byte1><SCRIPT language=JavaScript>changebyte1(document.test.icqcontent.value,20);</SCRIPT></SPAN>
</form>
function strlength(str){
var l=str.length; var n=l;
for (var i=0;i<l;i++){if (str.charCodeAt(i)<0||str.charCodeAt(i)>255) n++;}
return n;
}
function changebyte(value,length){
var l=strlength(value);
if (l<=length) {if (document.all!=null) document.all("byte").innerText="還可以輸入"+(length-l)+"字節";}
else{document.all("byte").innerText="輸入字節數超出范圍";}
return true;
}
function changebyte1(value,length){
var l=strlength(value);
if (l<=length) {if (document.all!=null) document.all("byte1").innerText="還可以輸入"+(length-l)+"字節";}
else{document.all("byte1").innerText="輸入字節數超出范圍";}
return true;
}
function changebyte2(value,length){
var l=strlength(value);
if (l<=length) {if (document.all!=null) document.all("byte2").innerText="還可以輸入"+(length-l)+"字節";}
else{document.all("byte2").innerText="輸入字節數超出范圍";}
return true;
}
</script>
<form method="post" name=test onSubmit="return checkdata()" action="">
<TEXTAREA onkeydown="return changebyte1(document.test.icqcontent.value,20)" onkeyup="return changebyte1(document.test.icqcontent.value,20)" name=icqcontent cols=40 rows="3"></TEXTAREA>
<SPAN id=byte1><SCRIPT language=JavaScript>changebyte1(document.test.icqcontent.value,20);</SCRIPT></SPAN>
</form>