티스토리 뷰
<html>
<head>
<script language="javascript">
function chklen(content, len)
{
var msg = content.value;
var msglen = len.value;
var i = 0, l = 0, temp = "", lastl = 0;
while (i < msg.length)
{
temp = msg.charAt(i);
if (escape(temp).length > 4) l += 2;
else if (temp != '\r') l++;
if (l > 80)
{
alert("80 bytes가 초과되었습니다.");
content.value = content.value.substr(0, i);
l = lastl;
break;
}
lastl = l;
i++;
}
len.value = l;
}
</script>
</head>
<body>
<form name="frm">
<textarea id=sms_content name=sms_content rows=5 cols=16 onkeyup="chklen(this, this.form.len);"></textarea>
<input id=len type=text name=len size=2 maxlength=2 readonly value=0 style="text-align:right;">
</form>
</body>
</html>