javascript program with a flowchart to find the length of a string with form values entered by the user
In this tutorial, we will try to learn the followings;
- Flowchart to find the length of a string.
- javascript program to find the length of a string.
- javascript program to find the length of a string with form values entered by the user.
Flowchart to find the length of a string.

javascript program to find the length of a string.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<html> <body> <button onclick="my()">click me</button> <p id="d"></p> <script> function my() { var str="PAKISTAN"; var a=str.length
; document.getElementById("d").innerHTML=a; } </script> </body> </html> |
javascript program to find the length of a string with form values entered by the user.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<html> <body> <input id="num"> <button onclick
="my()">click me</button> <p id="d"></p> <script> function my() { var str; str=document.getElementById("num").value; var a=str.length; document.getElementById("d").innerHTML=a; } </script> <H5>www.sitebay.com/cpp-program/cpp-SHOW THE LENGTH OF STRING</H5> </body> </html> |
Topic Covered
javascript program to find the length of a string.
List of All Programs of Javascript : Click Here .