Copy code code as follows:
<! Doctype HTML PUBLIC "-// W3C // DTD XHTML 1.0 Transitional // EN" http://www.w3.org/xhtml1/dtddml1-transitationAl.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" /> />
<Title> Non -Title Document </Title>
</head>
<body>
<textarea id = "text" color = "20" rows = "5" onkeyup = "SUM ()" Onfocus = "Focu ()"> </Textarea>
<span id = "span"> </span>
</body>
<script>
Function Sum () {
var str = document.GetelementByid ("text");
var control = str.value;
var len = Cont.Length;
document.GetelementByid ("span"). Innerhtml = "You currently entered"+len+"character";
if (len> = 100) {alert ("You can't write anymore, it has reached the maximum!");
document.GetelementByid ("Text"). Value = Cont.substr (0,99);
// Implement a maximum limit of 100 words. If it exceeds, it will not write data!
}
}
</script>
</html>