Write an
HTML page that has one input, which can take multi-line text and a submit button. Once the user clicks the submit button, it should show the number of characters, words and lines in the text entered
using an alert message. Words are separated with white space and lines are
separated with new line character.
<html>
<head>
<title>WT Lab
Experiment-3</title>
<script
type="text/javascript">
var
cnt;
function
wordcount(count) {
var
words = count.split(/\s/);
var
lines = count.split("\n").length;
cnt
= words.length;
document.getElementById('w_count').value
= cnt;
document.getElementById('c_count').value
= count.length;
document.getElementById('l_count').value
= lines;
}
</script>
</head>
<body>
<pre><b>
Input
Box : <textarea name="ta" rows="10"
cols="30"
onkeyup="wordcount(this.value)"></textarea>
<br> No.of
Words : <input type=text id="w_count" size="4"
readonly><br>
<br>No.of
Characters : <input type=text id="c_count" size="4"
readonly><br>
<br> No.of
Lines : <input type=text
id="l_count" size="4" readonly><br>
</b></pre>
</body>
</html>
output
For more info regarding technology and pro stuff...visit http://peoplezmind.com/
thank u for the program dude
ReplyDelete