【รหัส HTML 】
<table> <tr> <td> เนื้อหา SMS: </td> <td> <textarea name = "message" cols = "96" rows = "5" onkeydown = "textCounter (ข้อความ, remlen, 65); name = "remlen" type = "text" value = "65" size = "5" readonly = "readonly"> อักขระและจำนวนอักขระสูงสุดที่อนุญาตสำหรับข้อความแต่ละข้อความคือ <strong> 65 </strong>
【รหัส JS ที่เกี่ยวข้อง】
<script> function textCounter (ฟิลด์, countfield, maxlimit) {ถ้า (field.value.length> maxlimit) field.value = field.value.substring (0, maxlimit); elsecountfield.value = maxlimit - field.value.length;