<html><body>
<script>
function get_byte(str) {
byteNum = str.length;
temp = str.match(/[^\x00-\x80]/ig);
if(temp != null){
byteNum += temp.length;
}
return byteNum;
} </script>
<input type="text" value="" onblur="alert(get_byte(this.value))">
</body>
</html>
</script>
<input type="text" value="" onblur="alert(get_byte(this.value))">
</body>
</html>
<script>
function get_byte(str) {
byteNum = str.length;
temp = str.match(/[^\x00-\x80]/ig);
if(temp != null){
byteNum += temp.length;
}
return byteNum;
} </script>
<input type="text" value="" onblur="alert(get_byte(this.value))">
</body>
</html>
</script>
<input type="text" value="" onblur="alert(get_byte(this.value))">
</body>
</html>
例如:当byte〉200时,给出alert,提示错误~
------------------------------------------
请 DeluxWorld(曾经的你)兄指点迷津
结贴~