Skip to main content

HTML forms-Week 3

  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>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Input Box : <textarea name="ta" rows="10" cols="30"  onkeyup="wordcount(this.value)"></textarea>
          <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No.of Lines : <input   type=text id="l_count" size="4" readonly><br>
        </b></pre>
        </body>
        </html>

output

HTML forms-Week 3


For more info regarding technology and pro stuff...visit http://peoplezmind.com/




Comments

Post a Comment

Popular posts from this blog

CPU Schedueling programs

        Fcfs program         #include<stdio.h> #include<conio.h> main() { int bt[20], wt[20], tat[20], i, n; float wtavg, tatavg; printf("\nEnter the number of processes -- "); scanf("%d", &n); for(i=0;i<n;i++) { printf("\nEnter Burst Time for Process %d -- ", i); scanf("%d", &bt[i]); } wt[0] = wtavg = 0; tat[0] = tatavg = bt[0]; for(i=1;i<n;i++) { wt[i] = wt[i-1] +bt[i-1]; tat[i] = tat[i-1] +bt[i]; wtavg = wtavg + wt[i]; tatavg = tatavg + tat[i]; } printf("\t PROCESS \tBURST TIME \t WAITING TIME\t TURNAROUND TIME\n"); for(i=0;i<n;i++) printf("\n\t P%d \t\t %d \t\t %d \t\t %d", i, bt[i], wt[i], tat[i]); printf("\nAverage Waiting Time -- %f", wtavg/n); printf("\nAverage Turnaround Time -- %f", tatavg/n); getch(); } Output SJF program #include<stdio.h> #include<conio.h> main() { int p[20], bt[20], wt[20],...

Code A Clock And 'C'

The Clock Program For all the coders out there and those who are looking for crazy stuff in coding,this clock program is a brain riddle and gets you crazy enough. Have you ever tried writing a program that can display a classic clock that actually works?So,here it is. The clock that runs with "C". #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> struct hand{ int x; int y; }; int only_star; char getSymbol(int angle ); int main(int argc, char *argv[]) {     char plane[220][500];     int t,k,x,y,size,clck_x,clck_y,radius;     double  val = 3.14159 / 180; //Input the dimention of the clock. printf("Enter the size of the clock (max -> 200)(best visible at range 30-60) : "); scanf("%d",&size); printf("\nDo you want star symbol for hands (yes -> 1)(no -> 0) : "); scanf("%d",&only_star); //set the dementions of the clock layout. clck_x...

DOM and SAX parser-Week5

 Create an XML document that contains 10 users information. Write a Java program, which takes User Id as input and returns the user details by taking the user information from the XML document using (a) DOM Parser and (b) SAX parser. Task (a): DOM Parser           File Name: use r s.xml         <users-details>         <user>         <userid>1111</userid>         <name>Sammulal</name>         <address>Hyderabad</address>         <gender>Male</gender>         </user>         <user>         <userid>1112</userid>  ...