Advertisement
Aniket_Goku

js3

Apr 22nd, 2021
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.     <head>
  3.         <title>js3</title>
  4.     </head>
  5.     <script>
  6.         function  f1()
  7.         {
  8.             var data=document.getElementById("c").value;
  9.             var i,ch=1;
  10.            
  11.             for(i=0;i<=data.length;i++)
  12.             {
  13.                 if(data[i]==" ")
  14.                 {
  15.                     ch++;
  16.                     continue;
  17.                 }
  18.                
  19.             }
  20.             alert('Total no of Words: '+ ch);
  21.         }
  22.     </script>
  23.     <style>
  24.         body
  25.         {
  26.             background-image:url("file:///D:/backgrounds/61.jpg");
  27.             backdrop-filter:blur(5px);
  28.             background-color:grey;
  29.             height:100vh;
  30.             background-size:100% 100%;
  31.             margin:0;
  32.             padding:0;
  33.         }
  34.         .s1
  35.         {
  36.             width:60%;
  37.             height:50px;
  38.             font-size:27px 
  39.            
  40.         }
  41.         .s2
  42.         {
  43.             width:20%;
  44.             height:30px;
  45.             height:50px;
  46.             font-size:35px;
  47.             font-family:pristina;
  48.         }
  49.     </style>
  50.     <body >
  51.         <center>
  52.             <h1> Count Words</h1>
  53.             <stamp class="s1" style="background:transparent">*Press tab after giving data*<stamp>
  54.         </center>  
  55.         <table border="0" align="center" width=80% cellspacing="50">
  56.             <form onsubmit="">
  57.                 <tr>
  58.                     <td align=center>   <input type="textbox"id="c" class="s1" placeholder="Enter the sentence"></td>
  59.                 </tr>
  60.                 <tr>
  61.                     <td align="center">     <input type="submit" class="s2" value="Count words" onclick="f1()" ></td>
  62.                 </tr>
  63.                    
  64.             </form>
  65.         </table>
  66.     </body>
  67.  
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement