final pw lab pgm vtu1

28
Pw lab pgms: BY MANJU:-- 1. Develop and demonstrate a XHTML document that illustrates the use external style sheet, ordered list, table, borders, padding, color, and the <span> tag. lab1.html <?xml version = "1.0" encoding = "utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head><title>Ordered List</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <body bgcolor="orange"> <h1>Ordered List</h1> <ol><li>Software Engineering</li> <ol> <li>Six essentials of SE</li> <li>Emergent Properties of SE</li> <li>Socio technical reasons of SE</li> <ol> <li>Security</li> <li>Vulnerability</li> </ol> </ol> </ol> <h1>Table</h1> <table border=1 > <tr class="row1"> <th>Emp Number</th> <th>Name</th> <th>Designation</th> <th>Date of Joining</th> <th>Salary</th> </tr> <tr class="row2"> <td>E101</td> 1 http://firefriendsmanju.webs.com| :-

Upload: pavan-kotyal

Post on 20-Nov-2014

124 views

Category:

Documents


0 download

TRANSCRIPT

Pw lab pgms: BY MANJU:-1. Develop and demonstrate a XHTML document that illustrates the use external style sheet, ordered list, table, borders, padding, color, and the tag. lab1.html Ordered List Ordered List Software Engineering Six essentials of SE Emergent Properties of SE Socio technical reasons of SE Security Vulnerability Table Emp Number Name Designation Date of Joining Salary E101 Rakesh Software Engineer 24-4-1998 22000 E102 Rajesh Senior Engineer 1 http://firefriendsmanju.webs.com| :-

Pw lab pgms: 24-4-1999 18000 E103 Prashanth Software Engineer 24-4-2000 18000 Representing Border Style Welcome to CGI programming Welcome to Scripting Welcome to CSS Representing Span tag dsfkWelcome to HTML with CSS klsjdfklsjdsfkWelcome to Scripting Style.css h1{text-decoration:underline} ol{list-style-type:upper-roman;} ol ol{list-style-type:upper-alpha;} ol ol ol{list-style-type:decimal;} ol.one{list-style-type:lower-roman;} ol.one ol.one {list-style-type:lower-alpha;} ol.one ol.one ol.one{list-style-type:decimal;} table { border-top-width:low; border-bottom-width:thick; border-left-width:medium; border-right-width:thin; border-top-color:red; border-bottom-color:gray; border-left-color:blue; border-right-color:purple; border-top-style:dotted; border-bottom-style:dashed; border-left-style:double; border-right-style:line;

2 http://firefriendsmanju.webs.com| :-

Pw lab pgms: margin-left:0.5in; margin-right:0.5in; margin-top:0.5in; margin-bottom:0.4in; padding-left:7in; padding-right:9in; padding-top:12.5in; padding-bottom:1.4in; } tr.row1{background:"red";} tr.row2{color:"teal";} p.borders1{border-style:dashed;} p.borders2{border-style:dotted;} p.borders3{border-style:double;} .spanblue{font-size:24pt; font-family:"gothic"; color:"blue"; font-weight:300; } OUTPUT:

3 http://firefriendsmanju.webs.com| :-

Pw lab pgms: 2. Develop and demonstrate a XHTML file that includes Javascript script for the following problems: a) Input: A number n obtained using prompt Output: The first n Fibonacci numbers var fib1=0,fib2=1,fib=0; var num = prompt("Enter a number : \n", ""); if(num!=null && num>0) { document.write("" + num + " Fibonocci are
"); if(num==1) document.write(" "+ fib1 + ""); else document.write("" + fib1 + " " + fib2 + ""); for(i=3;i function disp(str) { sml=-1; alert(str.value) text = str.value var ia = text.toLowerCase().indexOf("a"); var ie = text.toLowerCase().indexOf("e"); var ii = text.toLowerCase().indexOf("i"); var io = text.toLowerCase().indexOf("o"); var iu = text.toLowerCase().indexOf("u"); if(ia >= 0) sml=ia; else if(ie >= 0) sml=ie; else if(ii >= 0) sml=ii; else if(io >= 0)sml=io; else if(iu>=0) sml=iu; if(sml != -1) alert("The leftmost position of the vowel is " + sml); else alert("No vowel found"); } Enter a String :

6 http://firefriendsmanju.webs.com| :-

Pw lab pgms: 3. b) Parameter: A number Output: The number with its digits in the reverse order function disp(num) { var rn=0, n= Number(num.value); while(n!=0) { r = n%10; n = Math.floor(n/10); rn = rn*10 + r; } alert("The " + num.value + " in reverse is " + rn); } Enter a number : Output:--

7 http://firefriendsmanju.webs.com| :-

Pw lab pgms:4. a) Develop and demonstrate, using Javascript script, a XHTML document that collects the USN ( the valid format is: A digit from 1 to 4 followed by two upper-case characters followed by two digits followed by two upper-case characters followed by three digits; no embedded spaces allowed) of the user. Event handler must be included for the form element that collects this information to validate the input. Messages in the alert windows must be produced when errors are detected.

function go() { document.f1.t1.focus(); } function check() { var n=document.f1.t1.value; alert(n); reg= /^([1-4][A-Z][A-Z]\d{2}[A-Z][A-Z]\d{3})$/ ; var k= reg.test(n) ; if(k==false) alert("Invalid USN = "+ n +" test = " + reg.test(n)); else alert("valid USN = "+ n +" test = " + reg.test(n)); } function check1() { n=document.f1.t1.value; alert("n= "+n); reg= /^([1-4][A-Z][A-Z]\d{2}[A-Z][A-Z]\d{3})$/ ; var k= reg.test(n) ; if(k==false) alert("Invalid USN = "+ n +" test = " + reg.test(n)); else alert("valid USN = "+ n +" test = " + reg.test(n)); } Enter USN = 8 http://firefriendsmanju.webs.com| :-

Pw lab pgms:4b) Modify the above program to get the current semester also (restricted to be a number from 1 to 8) 4b.html function getsem() { var usn = document.f1.t1.value; reg= /^([1-4][A-Z][A-Z]\d{2}[A-Z][A-Z]\d{3})$/ ; var k= reg.test(usn) ; if(k==false) { alert("Invalid USN = "+ usn +" test = " + reg.test(usn)); } if (k==true) { alert("valid USN = "+ usn +" test = " + reg.test(usn)); var s = usn.substring(3,5); var s1 = parseInt(s); var today=new Date(); var thisyear = today.getFullYear(); var k=s; var k1="20"+s; var joinyear = parseInt(k1); var y=thisyear-joinyear; if(y>3) { y=3; } var m=today.getUTCMonth(); m=m+1; if(m ]> STUDENT DETAILS Register Number : 1SSO6CS001 NAME : AAAAAAAA College : SSIT COURSE : CSE Year of Joining : 2006 Email : [email protected] Register Number : 1SSO6CS002 NAME : BBBBBBBB College : SSIT COURSE : CSE Year of Joining : 2006 14 http://firefriendsmanju.webs.com| :-

Pw lab pgms: Register Number NAME College COURSE Year of Joining Email lab6a.css student { background-color: cyan; width: 100%; } title{ font-weight:bold; font-color:maroon; font-size:65pt; text-decoration:underline; margin-left:250pt; } students { display: block; margin-bottom: 30pt; margin-left: 10pt; background-color:pink; } usn,name,college,branch,joiningyear,emailid { font-size:20pt; display: block; color: #000000; margin-left: 20pt; 15 http://firefriendsmanju.webs.com| :: : : : : : 1SSO6CS004 CJCJCJCJCJ SSIT CS 2005 [email protected] Email Register Number NAME College COURSE Year of Joining Email : : : : : : : [email protected] 1SSO6CS003 CCCCCCCC SSIT CSE 2006 [email protected]

Pw lab pgms: } regno,name1,cname,course,jy,email{ font-size:30pt; font-weight:bold; font-color:blue; } 6b) Create an XSLT style sheet for one student element of the above document and use it to create a display of that element. 6b.xml 1RN08ISE Amar RNSIT ISE 2007 [email protected] 6b.xsl Style sheet for 5b.xml VTU Student Description USN:
Name:
College:
Branch:
Year of Join:
16 http://firefriendsmanju.webs.com| :-

Pw lab pgms: E-Mail:
7. a) Write a Perl program to display various Server Information like Server Name, Server Software, Server protocol, CGI Revision etc. Program7a.html Server Info
program7a.pl #!/usr/bin/perl printparam("msg"); print'Greeting message'-bgcolor=>'1E90FF'); print h2("Hello $name"); my $r=int(rand(4)); print "random-".$r; if($r==0) { print h2("Hai".$name); } if($r==1) { print h2("great Day".$name); } print "
"; if($r==2) { print h2("Welcome".$name); 19 http://firefriendsmanju.webs.com| :-

Pw lab pgms: } print "
"; if($r==3) { print h2("Good day".$name); } print end_html();

8. b) Write a Perl program to keep track of the number of visitors visiting the web page and to display this count of visitors, with proper headings. 8b.pl #! /usr/bin/perl use CGI:standard; use strict; use DBI; my $c; my $dbh=DBI->connect(DBI:mysql,root,iamgod); my $sth=$dbh->prepare(select * from visitors); $sth->execute(); $c=$sth->fetchrow(); print header(), start_html(), h1(count=$c), end_html(); $c=$c+1; $sth=$dbh->prepare(update visitors set count=?); $sth->execute($c); $sth->finish(); $dbh->disconnect(); exit(0); //check single quotes and double quotes correctly in above pgm//pgm is fine!!11. Write a PHP program to store current date-time in a COOKIE and display the Last visited on date-time on the web page upon reopening of the same page

11.php

12. Write a PHP program to store page views count in SESSION, to increment the count on each refresh, and to show the count on web page. 12.php

10. Write a Perl program to insert name and age information entered by the user into a table created using MySQL and to display the current contents of this table. Name :
Age :
21 http://firefriendsmanju.webs.com| :-

Pw lab pgms:

10.pl #! /usr/bin/perl print "Content-type: text/html\n\n"; print "Result of the insert operation "; use CGI ':standard'; use DBI; $dbh=DBI->connect("DBI:mysql:test","root",""); $name=param("name"); $age=param("age"); $qh=$dbh->prepare("insert into stud values('$name','$age')"); $qh->execute(); $qh=$dbh->prepare("select * from stud"); $qh->execute(); print "NameAge"; while ( ($name,$age)=$qh->fetchrow()) { print "$name$age"; } print ""; $qh->finish(); $dbh->disconnect(); print"";

22 http://firefriendsmanju.webs.com| :-