USN: 2VX13MCA14 SUBJECT CODE:13MCA18



1. Create an XHTML page to demonstrate the usage ofa. Text formatting tagsb. Linksc. Imagesd. TablesSOURCE CODE<? xml version="1.0" encoding="utf-8" ?><! DOCOTYPE html PUBLIC "-//f2z//DTD XHTML 1.1//EN"" 111/DTD/xhtml 11.dtd"><html xmlns=""><head><title>Text formatting, links, image, table</title></head><a href="6a.html"> click here for link </a><body><image src="Koala.jpg" height="80" width="80"><p><h2>Formatting tags</h2><br><h2>Italic: <i>This is in italic</i></h2><br><h3>Bold: <b>This is in Bold</b></h3><br><h4>Underline: <u>This is in underlined</u></h4><br></p><table border="border"><caption>Department of PG studies</caption><tr><th></th><th>MBA</th><th>MCA</th><th>M.Tech</th></tr><tr><th>Boys</th><td>30</td><td>25</td><td>35</td></tr><tr><th>Girls</th><td>20</td><td>23</td><td>40</td></tr></html></body>OUTPUT:2. Develop and demonstrate the usage of inline and external style sheet using cssSOURCE CODE<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.1//EN" ""><html xmlns="http:1999/xhtml"><link rel="stylesheet" type="text/css" href="vt1313.css"/><head><title>Usages of Inline & External style sheet using CSS</title></head><body><h1 class="major"> Welcome to VTU JnanaSangama</h1><p class="minor"> VTU is one of the top and best university. It has three departments, ie MCA, M-tech, MBA.</p><p class="minor", style="color:red"> Nearly 192 colleges are affiliated to VTU university. It has fast growing process all over the colleges. It can be said that, VTU university is one of the best reputed university.</p><p class="minor"> Nearly 192 colleges are affiliated to VTU university. It has fast growing process all over the colleges. It can be said that, VTU university is one of the best reputed university.</p><h3 class="pree"><u> Department of MCA </u></h3><ul style="color:red"><li> MCA </li><li> M-tech </li><li> MBA </li></ul></body></html><style> .pree{color:red;}</style>h1.major{font-size:25pt;font-family:'algerian';font-style:bold;text-align:center;text-indent:0.5in;color:black;background-color:blue;}p.minor{font-size:15pt;font-family:'algerian';font-style:bold;text-align:left;text-indent:1.5in;color:blue;background-color:yellow;}OUTPUT:3. Develop and demonstrate a XHTML that includes JavaScript for the followingproblems:a. Input: A number n obtained using promptOutput:The first n fibonacci seriesSOURCE CODE<?xml version="1.0" encoding="utf-8"?><?DOCTYPE html PUBLIC "=//ww./1999/TR/xhtml 11/DTD/xhtml11.dtd"><html xmlns=""><head><title>fiboncci series</title></head><body><h1> calculating Fibonacci numbers </h1><script type="text/javascript">n=prompt("Enter a number")varn,a=0,b=1,i,c;if(n<0) alert("Invalid no")else{if(n==1) document.write(a)elsedocument.write(a+"<br/>"+b)for(i=2;i<=n;i++){ c=a+b a=b b=cdocument.write("<br/>"+c)}}</script></body></html>OUTPUT:3 b. Input: A number n obtained using promptOutput: A table of numbers from 1 to n and their squares using alertSOURCE CODE<?xml version="1.0" encoding="utf-8"?><?DOCTYPE html PUBLIC "=//ww./1999/TR/xhtml 11/DTD/xhtml11.dtd"><html xmlns=""><head><title>squre of a number</title></head><body><h1> calculating square of numbers </h1><script type="text/javascript">varn,i,b;n=prompt("Enter a number")if(n<=0) alert("Invalid number")else{for(i=1;i<=n;i++){document.write(i,"*",i,"=")b=i*i;document.write(b,"<br/>")}}</script></body></html>OUTPUT:4. Develop and demonstrate using JavaScript, a XHTML document that displays random numbers (integers).SOURCE CODE<?sxml version="1.0" encoding="utf-8" ?><! DOCOTYPE html PUBLIC "-//f2z//DTD XHTML 1.1//EN"" 111/DTD/xhtml 11.dtd"><html xmlns=""><head><title>Random numbers </title></head><body><p id="demo">Click the button to display the random number between 1 to 10</p><button onclick="fun()">Try it</button><script>function fun() {var x=document.getElementById("demo")x.innerHTML=Math.floor((Math.random()*10)+1); }</script></body></html>OUTPUT:5 a. Develop and demonstrate , using javascript 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 are allowed) of the user. Event handler must be included for the form element that collects this information to validate the input.Messages must be produced when errors are detected.SOURCE CODE<?xml version="1.0" encoding="utf-8"?><?DOCTYPE html PUBLIC "=//ww./1999/TR/xhtml 11/DTD/xhtml11.dtd"><html xmlns=""><head><title> Student USN</title></head><h1> Validating student USN</h1><body><center><script type="text/javascript">functionfunc(usn){var pattern1=/^[1-4][A-Z]{2}[0-9]{2}[A-Z]{2}[0-9]{3}$/ if (!usn.value.match(pattern1)||usn.value.length==0) {alert(" Invalid usn");return false;}elsealert("usn valid !");}</script><form action=" "><p>USN: <input type= "text" name= "usn" /><br /><input type= "button" value= "validate" onclick="func(usn)" /></p></form></center></body></html>OUTPUT:5 b. Modify the 5a program to get the current semester also(restricted to be a number from 1 to 6)SOURCE CODE<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"""><html xmlns=""><head><title>USN and Semester Validation</title></head><body><center><script type="text/javascript">functionfunc(usn,sem){var pattern1=/^[1-4][A-Z]{2}[0-9]{2}[A-Z]{2}[0-9]{3}$/if(!usn.value.match(pattern1)||usn.value.length==0){alert ("Invalid USN!\nEnter a valid USN")return false}else alert("USN valid!")var pattern2=/^[1-6]$/if(!sem.value.match(pattern2)||sem.value.length==0){alert("Invalid Semester!\nEnter a valid Semester")return false}else alert("Semester valid!")}</script><form action=" "><p>USN:&nbsp&nbsp&nbsp<input type="text" name="usn" /><br/><br/>Semester: <input type="text" name="sem"/><br/><br/><input type="button" value="Validate" onclick="func(usn,sem)" /></p></form></center></body></html>OUTPUT:6 a. Develop and demonstrate using javascript script, a XHTML document that contains three images, stacked on top of each other, with only enough of each showing so that the mouse cursor can be placed over a sime part of them . When the cursor is placed over the exposed part of any paragraph, it should rise to the top to become completely visibleSOURCE CODE<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC"-//w3c//DTD xhtml 1.1//EN"""><html xmlns=""><head><title>Stack Layers</title><style>p{position:absolute;text-align: center;border: solid thick black;padding: 2em;width: 400px;top:25px;right:25px;}.para1{background-color:green;top:100px;left:300px;}.para2{background-color:pink;top:120px;left:320px;}.para3{background-color:yellow;top:140px;left:340px;}</style><script>val=0;function pull(obj,inc){val=val+inc;obj.style.zIndex=val;}</script></head><body bgcolor="white"><p class="para1" onmouseover="pull(this,1)">First Para</p><p class="para2" onmouseover="pull(this,1)">Second Para</p><p class="para3" onmouseover="pull(this,1)">Third Para</p></body></html>OUTPUT:6 b. Modify the above (6a) document so that when an image is moved from the top stacking position it returns to its original position rather then to the bottomSOURCE CODE<?xml version="1.0"?><!DOCTYPE html><html xmlns=""><head><title>Stack Layers</title><style>p{position:absolute;text-align: center;border: solid thick black;padding: 2em;width: 400px;}.para1{background-color:green;top:100px;left:300px;}.para2{background-color:pink;top:120px;left:320px;}.para3{background-color:yellow;top:140px;left:340px;}</style><script>val=0;function pull(obj,inc){val=val+inc;obj.style.zIndex=val;}</script></head><p class="para1" onmouseover="pull(this,1)" onmouseout="pull(this,-1)">First Para</p><p class="para2" onmouseover="pull(this,1)" onmouseout="pull(this,-1)">Second Para</p><p class="para3" onmouseover="pull(this,1)" onmouseout="pull(this,-1)">Third Para</p></body></html>OUTPUT:7. Develop using java script, an XHTML documents that use of on load and on focus events.SOURCE CODE<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC"_//W3C//DTD/XHTML1.1//EN"""/><html xmlns=""><head><title>Onload_Onfocus_Events</title><script type="text/javascript" src="style.js"></script></head><body onload="chkphone();"><h2>Customer Info</h2><form action =" "><p><input type="text" id="phone" />Phone </label><input type="reset" id="reset" /><input type="submit" id="submit" /></p></form><script>document.getElementById("phone").onchange=chkphone;</script></body></html>Style.jsfunctionchkphone(){ varmyphone=document.getElementById("phone");varpos=myphone.value.search(/^\d{3}-\d{3}-\d{4}$/)if(pos !=0) {alert("Invalid")myphone.focus();myphone.select();return false; }else {alert("Valid")myphone.select();myphone.focus();return true; }} OUTPUT 1:OUTPUT 2:8a. Design an XML document to store information about a student in an engineering college affiliatd to vtu the information must include usn name name of the college branch year of joining and e-mail id. Make up sample data data for 3 students .Create a css style sheet and use it to display the document.SOURCE CODE<?xml version="1.0" encoding="utf-8"?><?xml-stylesheethref="Info.css" type="text/css"?><student><stud-info>Student Information</stud-info><stud1><usn>USN: 2VX13MCA06</usn><name>Name: BahubaliUgare</name><noc>College: VTU</noc><branch>Branch: MCA</branch><yoj>Year: 2013</yoj><eid>Email: bahubaliugare@</eid></stud1><br/><stud2><usn>USN: 2VX13MCA19</usn><name>Name: BannuPatil</name><noc>College: VTU</noc><branch>Branch: MCA</branch><yoj>Year: 2013</yoj><eid>Email: bannupatil@</eid></stud2><br/><stud3><usn>USN: 2VX13MCA07</usn><name>Name:Manjunath A</name><noc>College: VTU</noc><branch>Branch: MCA</branch><yoj>Year: 2013</yoj><eid>Email: manjualgundi@</eid></stud3></student>Info.cssstud-info { display:block; color:blue; font-style:italic; font-size:200%; }student { display:block; font-size:100%; }stud1 { display:block; color:blue; }stud2 { display:block; color:red; }stud3 { display:block; color:brown; } usn,name,noc,branch,yoj,eid { display:block; }OUTPUT:8b. Create an XSLT style sheet for one student element of the above document and use it to create a display of that element.SOURCE CODE<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="lab8b.xsl"?><studinfo><student><usn>2VX11MCA01</usn><name>Bahubali</name><college>VTU BGM</college><branch>MCA</branch><year>2013 </year><email>bahubaliugare@</email></student></studinfo>lab8b.xsl<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl=""xmlns=""><xsl:template match="student"><html><body><span style="color:red;font-size:20pt"><xsl:value-of select="usn"/></span><br/><span style="color:green;font-family:agency FB;font-size:25"><xsl:value-of select ="name"/></span><br/><span style="color:blue"><xsl:value-of select="college"/></span><br/><span style="color:gray"><xsl:value-of select="branch"/></span><br/><span style="color:brown"><xsl:value-of select="year"/></span><br/><span style="font-style:italic"><xsl:value-of select="email"/></span><br/><br/></body></html></xsl:template></xsl:stylesheet>OUTPUT:9. Write a Perl program which demonstrates the usage of scalar variables and arraysSOURCE CODE9.html<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 //EN" ""><html xmlns=""><head><title> scalar variables and arrays </title></head><body><form method="get" action=""><h1> Demonstrate scalar variables and arrays</h1><input type="submit" value="Enter"></form></body></html>9.pl#!c:/xampp/perl/bin/perl.exeuseCGI':standard';print "content-type:text/html","\n\n";print "<html><body>";print "<br>","server name:",$ENV{'SERVER_NAME'};print "<br>","server software :",$ENV{'SERVER_SOFTWARE'};print "<br>","server protocol:",$ENV{'SERVER_PROTOCOL'};print "<br>","cgi revision:",$ENV{'GATEWAY_INTERFACE'};print "</body></html>";exit(0);OUTPUT:10. Write a Perl program to display various Server information like Server Name, Server Software, Server protocol,CGI Revision etc.SOURCE CODEpgm10.html<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 //EN" ""><html xmlns=""><head><title> About this server </title></head><body><form method="get" action=""><h1> Click on enter to see the server information </h1><br><input type = "submit" value="Enter" ></form></body></html>pgm10.pl#!c:/xampp/Perl/bin/perl.exeuseCGI':standard';print "content-type:text/html","\n\n";print "<html><body>";print "<br>","server name:",$ENV{'SERVER_NAME'};print "<br>","server software :",$ENV{'SERVER_SOFTWARE'};print "<br>","server protocol:",$ENV{'SERVER_PROTOCOL'};print "<br>","cgi revision:",$ENV{'GATEWAY_INTERFACE'};print "</body></html>";exit(0);OUTPUT:11. Write a Perl program to display a digital clock which displays the current time of the serverSOURCE CODEpgm11.html<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 //EN" ""><html xmlns=""><head><title> Digital clock </title><body><form method="get" action=""><hr><br><br><h3> Click on submit to see the time </h3><input type ="submit" value="submit"></form></body></html>pgm11.pl#!c:/xampp/perl/bin/perl.exeprint "refresh:1url=","\n";print "content-type:text/html","\n\n";print "<html>", "<body>", "<h1> The current time is....</h1>","\n";($sec,$min,$hour)=localtime(time);$ampm="am";if($hour>12){ $hour -= 12; $ampm="pm";if($hour==0) { $hour=12; }}printf("$hour:$min:$sec $ampm");print"</body></html>";OUTPUT:12. Write a Perl program to accept the User Name and display a greeting message randomly chosen from a list of 4 greeting messages.SOURCE CODEpgm12.html<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 //EN" ""><html xmlns=""><head><title> Greeting </title></head><body><form method="post" action=""><h1> Enter your name</h1><br><input type="text"name="yourname"><br><br><input type="submit" value="Enter"></form></body></html>pgm12.pl#!c:/xampp/Perl/bin/perl.exeuse CGI ':standard';print "content-type:text/html","\n\n";$name=param('yourname')|| 'abcd';my $range=4;my $random_number=int(rand($range));print"$random_number \n";if($random_number==0){print("Hello $name, welcome to Perl programming");}if($random_number==1){print("Good evening $name, how are you?");}if($random_number==2){print("Have a good day $name");}if($random_number==3){print("Thank you $name, for using fedora");}OUTPUT:13. Write a Perl program to keep track of the number of visitors visiting the web page and todisplay this count of visitors, with proper headings.SOURCE CODE13.html<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 //EN" ""><html xmlns=""><head><title>Run your first Perl script </title></head><body>Click on <a href="">this link </a>to run your first perl script.</body></html>13.pl#!c:/xampp/perl/bin/perl.exe#KEEPING COUNT OF VISITORS IN A FILEuseCGI':standard';print"content-type:text/html\n\n";#opening filein read modeopen(FILE,"<count.dat");$cnt=<FILE>;close(FILE);$cnt=$cnt+1;#opening file to writeopen(FILE,">count.dat");print FILE $cnt;close(FILE);print "The Number of times Visitor count is: $cnt";OUTPUT:14. Write a CGI-Perl program to use a cookie to remember the day of the last login from a user and display it when runSource Code:cookies.html<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 //EN" ""><html xmlns=""><head><title> COOKIES program </title><body><form method="get" action=""><hr><br><br><h3> Click on submit to see the COOKies info </h3><input type ="submit" value="submit"></form></body></html>cookies.pl#!c:/xampp/perl/bin/perl.exeuseCGI':standard';#print "content-type:text/html","\n\n";@last_day = cookie('last_time');$day_of_week = (qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)) [(localtime)[6]]; $month = (qw(January February March April May June July August September October November December))[(localtime)[4]];$day_of_month = (localtime)[3]; @day_stuff = ($day_of_week,$month,$day_of_month);$day_cookie = cookie(-name => 'last_time', -value => \@day_stuff, -expires => '+5d');print header(-cookie => $day_cookie);print "<html><body>";if(scalar(@last_day) == 0){ print "welcome to you on your first visit to our site\n";}else{($day_of_week,$month,$day_of_month)= @last_day;print "wel come back \n","your last visit was on ","$day_of_week,$month,$day_of_month";}print "</body></html>";exit(0);OUTPUT: ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download