Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>js3</title>
- </head>
- <script>
- function f1()
- {
- var data=document.getElementById("c").value;
- var i,ch=1;
- for(i=0;i<=data.length;i++)
- {
- if(data[i]==" ")
- {
- ch++;
- continue;
- }
- }
- alert('Total no of Words: '+ ch);
- }
- </script>
- <style>
- body
- {
- background-image:url("file:///D:/backgrounds/61.jpg");
- backdrop-filter:blur(5px);
- background-color:grey;
- height:100vh;
- background-size:100% 100%;
- margin:0;
- padding:0;
- }
- .s1
- {
- width:60%;
- height:50px;
- font-size:27px
- }
- .s2
- {
- width:20%;
- height:30px;
- height:50px;
- font-size:35px;
- font-family:pristina;
- }
- </style>
- <body >
- <center>
- <h1> Count Words</h1>
- <stamp class="s1" style="background:transparent">*Press tab after giving data*<stamp>
- </center>
- <table border="0" align="center" width=80% cellspacing="50">
- <form onsubmit="">
- <tr>
- <td align=center> <input type="textbox"id="c" class="s1" placeholder="Enter the sentence"></td>
- </tr>
- <tr>
- <td align="center"> <input type="submit" class="s2" value="Count words" onclick="f1()" ></td>
- </tr>
- </form>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement