bambeero
Threat Intelligence Analyst
Divine
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
Through this script ,words in paragraphs ,data ,and even whole articles will be counted automatically. How many times did you launch an entire word processor just to find out the number of words of a certain paragraph contains? If you have a site that contains forms, you could also include this script on the page to spare your visitors they had to go through in counting the number of words. You no longer need to waste your time just counting the words a particular site has. This kind of problem can be solve through this tutorial.
In this tutorial we are going to learn How To Make Word Count Using HTML JavaScript.
So, what is it all about?
This is a simple work, but it can help you to your site.
Example:
How To Make Word Count Using HTML JavaScript
*Just click the button name "Calculate" to view the result.
Try to edit the context above. To see the output you desire number of words to see.
Directions:
First: Kindly add this code below to the HEAD section of your page.
*This is for css, and you can customize the design.
Second: Kindly copy everything the code below and paste it where you want the script appear.
And that's all!!! Just DOWNLOAD the sourcecode, and try it.
Enjoy coding...
Download
In this tutorial we are going to learn How To Make Word Count Using HTML JavaScript.
So, what is it all about?
This is a simple work, but it can help you to your site.
Example:
How To Make Word Count Using HTML JavaScript
*Just click the button name "Calculate" to view the result.
Try to edit the context above. To see the output you desire number of words to see.
Directions:
First: Kindly add this code below to the HEAD section of your page.
- <style type=
"text/css"
>
- .button_calc
{
- background
:
buttonface
;
- width
:
100px
;
- height
:
40px
;
- font-size
:
20px
;
- cursor
:
pointer
;
- }
- .result_txt
{
- cursor
:
no-drop;
- width
:
150px
;
- height
:
40px
;
- text-align
:
center
;
- font-size
:
18px
;
- color
:
red
;
- }
- .input_txt
{
- border
:
1px
solid
red
;
- font-size
:
18px
;
- }
- div {
- margin-top
:
50px
;
- border
:
1px
solid
red
;
- }
- </style>
*This is for css, and you can customize the design.
Second: Kindly copy everything the code below and paste it where you want the script appear.
- <form
method
=
"POST"
name
=
"word_count"
>
- <script
language
=
"JavaScript"
>
- function countit(){
- var formcontent=document.word_count.word_count2.value
- formcontent=formcontent.split(" ")
- document.word_count.word_count3.value=formcontent.length
- }
- </
script
>
- <table
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
- <tr
>
- <td
width
=
"100%"
>
- <textarea
rows
=
"12"
name
=
"word_count2"
cols
=
"60"
class
=
"input_txt"
wrap=
"virtual"
>
Welcome to Sourcecodester!!! Do you have source code, articles, tutorials, web links, and books to share? You can write your own content here. You can even have your own blog. Submit now.</
textarea
>
- </
td
>
- </
tr
>
- <tr
>
- <td
width
=
"100%"
>
- <div
align
=
"left"
>
- <p
align
=
"center"
>
- <input
type
=
"button"
value
=
"Calculate"
onClick
=
"countit()"
class
=
"button_calc"
/
>
- <input
type
=
"text"
name
=
"word_count3"
size
=
"20"
class
=
"result_txt"
disabled
/
>
- </
p
>
- </
div
>
- </
td
>
- </
tr
>
- </
table
>
- </
form
>
And that's all!!! Just DOWNLOAD the sourcecode, and try it.
Enjoy coding...
Download
You must upgrade your account or reply in the thread to view hidden text.