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],...

JAVA progs-1

1.Write a Java program that prints all real solutions to the quadratic equation ax2 +bx+c = 0. Read in a, b, c and use the quadratic formula. If the discriminate b2 -4ac is negative, display a message stating that there are no real solutions import java.io.*; class Quadratic { public static void main(String args[])throwsIOException { double x1,x2,disc,a,b,c; InputStreamReader obj=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(obj); System.out.println("enter a,b,c values"); a=Double.parseDouble(br.readLine()); b=Double.parseDouble(br.readLine()); c=Double.parseDouble(br.readLine()); disc= (b*b)-(4*a*c); if (disc==0) { System.out.println("roots are real and equal "); x1=x2=b/(2*a); System.out.println("roots are "+x1+","+x2); } else if(disc>0) { System.out.println("roots are real and unequal"); x1=(-b+Math.sqrt(disc))/(2*a); x2=(b+Math.sqrt(disc))/(2*a); System....