WT Solution

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 45

Q.1 Write HTML and CSS code to design a web page.

Use External style sheet with appropriate


attributes to display information of each frame for Home Shopping.

Head:-

<html>

<body>

<link rel="stylesheet" type="text/css" href="q1.css">

<h1 align="center">Home Shopping</h1>

</body>

</html>

Home and kitchen appliances:-

<html>

<body>

<link rel="stylesheet"type="text/css"href="q1.css">

<b> kitchen and home appliances</b>

<ul type="disk">

<li><a href="q.1.4col.html">kitchen and dining

<li>furnishing

<li>home decor

<li>home improvement

</ul>

</body>

</html>

Kitchen & dining :-

<html>

<body>
<link rel="stylesheet"type="text/css"href="q1.css">

<b> Kitchen and dining</b>

<ul type="i">

<li>coookware

<li>kitchenware

<li>bakeware

<li>serveware

</ul>

</body>

</html>

CSS:-

body{background-color:pink}

h1{text-align:center;

color:black}

image:-

<html>

<body>

<link rel="stylesheet"type="text/css"href="q1.css">

<img src="desert.jpg" height="100" width="100">

</body>

</html>

Main:-

<html>

<frameset rows=10%,90%>
<frame src="q1.head1.html">

<frameset cols=40%,60%>

<frame src="img.html">

<frame src="q1.2col.html">

</html>

o/p

Q.2 Write HTML and CSS code to design a web page displaying list of hyperlinks. Use Inline style
sheet with appropriate attributes to display information of each frame for IT Industries in India.

Main:-

<html>

<head>

</head>

<frameset rows=10%,90%>

<frame src="q.2head.html">
<frameset cols=30%,70%>

<frame src="q21col.html">

<frame src=".html" name="link">

</frameset>

<body>

<style="bgcolor:red;">

</body>

</html>

Head:-

<html>

<head>

</head>

<body>

<style>

body{background-color:pink; text-align:"center"}</style>

<h1>IT Industries in INDIA</h1>

</body>

</html>

City:-

<html>

<body>

<b>City</b>

<ol type="1">

<li><a href="q23col.html" target="link">Pune</a>

<li><a href=" ">banglore</a>


<li><a href=" ">hydrabad</a>

<li><a href=" ">delhi</a>

</body>

</html>

Pune:-

<html>

<body>

<b>Pune</b>

<ul type="disk">

<li>Infosys

<li>TCS

<li>Tech mahindra

<li>Persistent

</body>

</html>

o/p:-

Q.3 Image slider


<html>
<script>

var i = 0;
var path = new Array();

path[0] = "one.jpg";
path[1] = "two.jpg";
path[2] = "three.jpg";

function swapImage()
{
document.slide.src = path[i];
if(i < path.length - 1)

i++;
else

i = 0;

setTimeout("swapImage()",1000);
}
window.onload=swapImage;

</script>

<img height="700" name = "slide" src="search_to_fade_by_xetobyte-


d3g0snv.jpg" width="700">

</html>

Q.4 Write a JavaScript program to read a number from user, store its factor into the array and display
that array. (Handle onClick Event).

<html>

<body>

<script type="text/javascript">

function factors()

var i,no;

var no1=document.getElementById("no").value;

for(i=1;i<=no1;i++)

if(no1%i==0)

{
var fa=[i];

document.write(fa);

document.write("<br>");

return 0;

</script>

<form>

<pre>

no: <input type="text" id="no">

<br>

<input type="submit" onclick="factors()">

</pre>

</form>

</body>

</html>

o/p:-
Q.5 Write HTML and CSS code to design a web page. Use Internal style sheet with appropriate
attributes to display information of each frame for Computer Application Department

Head:-

<html>

<head>

<title>head</title>

</head>

<body bgcolor="sky blue">

<font color="red">

<h1>COMPUTER APPLICATION DEPARTMENT</h1>

</font>

</body>

</html>

Table:-

<html>

<head>

<title>table</title>

</head>

<body>
<table border="1" cellspacing="5" bgcolor="skyblue" bordercolor="red" cellpadding="10">

<caption><font color="green" size="5">FYBCA Exam Time Table</font></caption>

<tr>

<th>date</th>

<th>time</th>

<th>subject code</th>

<th>subject name</th>

</tr>

<tr>

<th>12/10/2015</th>

<th>10:30 am -1:30 pm</th>

<th>101</th>

<th>PPA</th>

</tr>

<th>13/10/2015</th>

<th>10:30 am -1:30 pm</th>

<th>102</th>

<th>MOE</th>

</tr>

<th>14/10/2015</th>

<th>10:30 am -1:30 pm</th>

<th>103</th>

<th>BC</th>

</tr>

<th>15/10/2015</th>

<th>10:30 am -1:30 pm</th>

<th>104</th>
<th>PM</th>

</tr>

<th>16/10/2015</th>

<th>10:30 am -1:30 pm</th>

<th>105</th>

<th>FA</th>

</tr>

</body>

</table>

</html>

Main:-

<html>

<head>

<title>css</title>

<style>

body{background-color:red;}

</style>

</head>

<frameset cols="40%,60%">

<frame name="first" src="headQ5.html" >

<frame name="first" src="classQ5.html">

</frameset>

<body>

</body>

</html>
Class:-

<html>

<head>

<title> city</title>

</head>

<pre>

<h1>City</h1>

<ul>

<a href="tableQ5.html"><h2><li>FYBCA

<a href=""><li>SYBCA

<a href=""><li>TYBCA

</h2></ul>

</html>

o/p:-
Q.6 Write a JavaScript program to read a character string from user and perform the following
functions:
a) Accept a character from user and count the number of occurrences of that character in the
string.
b) Accept a Position from user and print the character at specified position (Use Prompt()).

<HTML>
<Head>
<Script type="text/javascript">
function count()
{
var s=document.frm.text.value;
if(document.getElementById("c1").checked==true)
{
var ch=prompt("Enter the character:");
var count=0;
for(var i=0;i<s.length;i++)
{
if(s[i]==ch)
count++;
}
alert("Occurence is"+count);
}
if(document.getElementById("c2").checked==true)
{
var p=prompt("Enter the position:");
var i=0;
while(i<=s.length)
{
if(i==p)
{
var d=i;
document.write(p+"position character is"+s.charAt(d));
}
i=i+1;
}
}
}
</Script>
</Head>
<Body>
<Form name="frm" onsubmit="return count()">
Enter string:<input type="text" name="text" id="c">
<Br><Br><input type="radio" name="opt" id="c1"> Accept character & count it occurence
<Br><Br><input type="radio" name="opt" id="c2"> print character at particular position
<Br><Br><input type="submit">
</Form>
</Body>
</HTML>

o/p:-

Q.7 same as home shopping.

Q.8 Write a JavaScript program to design student registration form and perform following validation
on null value, alphabets, mobile no, pin code for Student Registration form.

<html>

<body>

<form name="m" onsubmit="return val()">

<pre>
<br>name of student: <input type="text" name="nos">

<br>mobile no: <input type="text" id="mn" name="mn">

<br>address: <input type="text" name="addr">

<br>city: <input type="text" name="ct">

<br>state: <input type="text" name="st">

<br>pincode: <input type="text" id="pnc" name="pnc">

<br><input type="submit">

</pre>

</form>

<script>

function val()

var name=document.m.nos.value;

var mno=document.m.mn.value;

var ad=document.m.addr.value;

var cty=document.m.ct.value;

var sta=document.m.st.value;

var pn=document.m.pnc.value;

if(name=="" || mno=="" || ad=="" || cty=="" || sta==""|| pn=="")

alert("please enter information");

return false;

else if(mno.length!=10)

alert("mobile no should be 10 digit");

return false;

}
else if(pn.length!=6)

alert("pin no should be 6 digit");

return false;

</script>

</body>

</html>

o/p:-

Q.9 Write HTML code to design a website of facebook

Main:-
<HTML>

<Head></Head>

<Frameset rows="20%,80%">

<Frame src="homehead.html">

<Frameset cols="20%,80%">

<Frame src="homeleft.html">

<Frame src="homeright.html">

</Frameset>

</HTML>

Homehead:-

<HTML>

<Head></Head>

<Body>

<p align="center">Welcome to Pratiksha Jori<p align="left">Logout</p></p>

</Body>

</HTML>

Homeleft:-

<HTML>

<Head></Head>

<Body>

<a href="home.html">Home</a>

<Br><Br><a href="profile.html">Profile</a>

<Br><Br><a href="frndreq.html">Friend request</a>

</Body>

</HTML>
Homeright:-

<HTML>

<Head></Head>

<Body>

<Table>

<tr>

<th colspan="3">Rucha shared this link</th>

</tr>

<tr>

<td colspan="3"><img src="Hydrangeas.jpg" height="104" width="124"></td>

</tr>

<tr>

<td><input type="submit" value="Like"></td>

<td><input type="submit" value="Share"></td>

<td><input type="submit" value="Comment"></td>

</BOdy>

</HTML>

Profile:

<HTML>

<Body>

<pre>

Profile page <a href="home.html">Home</a>

<Br><br><Br><img src="Hydrangeas.jpg" height="56" width="56"> Pratiksha Jori

<Br><Br><input type="text" value="Comment"> Post

<Br><Br>Timeline Friends

</pre>

</BOdy>
</HTML>

o/p:-

Q.10 Write HTML code to design a website for Flight Reservation.

Head:-

<html>

<head>

<body>

<pre>

<img src="desert.jpg" height="50" width="60"> <b>AirIndia


<select name="select1" id="India"><option value="i">India</option><option
value="i">paris</option></select>
</pre>

</body>

</html>

Manage your trip:

<html>

<head>

</head>

<body>

<form action="details.html">

<input type="submit" value="manage your trip">

<input type="submit" value="home">

</form>

</body>

</html>

Booking:-

<html>

<head>

</head>

<body>

<form>

<table>

<tr>

<th>Booking Information</th>

</tr>

<tr>
<td>From:</td>

<td colspan=2><input type="text"></td>

</tr>

<tr>

<td>To:</td>

<td colspan=2<input type="text"></td>

</tr>

<tr>

<td>Departure Date:</td>

<td colspan=2><input type="text"></td>

</tr>

<tr>

<td>Returning Date:</td>

<td colspan=2><input type="text"></td>

</tr>

<tr>

<td>Adults </td>

<td>children </td>

<td>Economy </td>

</tr>

<tr>

<td><select name="select1" id="1 to 9 "><option value="z">1 to 9</option><option


value="z1">1</option><option value="z2">2</option><option
value="z3">3</option></select></td>

<td><select name="select1" id="0 to 9"><option value="p">0 to 9</option><option


value="p1">0</option><option value="p2">1</option><option
value="p3">2</option></select></td>

<td><select name="select1" id="Economy"><option value="m">Executive</option><option


value="m1">first</option></select></td>
</tr>

<tr>

<td colspan=3><input type="button" value="book now"></td>

</tr>

</table>

</form>

</body>

</html>

Details:

<html>

<head>

</head>

<body>

<p align="center">Manage your trip</p>

<h3><u>fare details for air india</u></h3>

<table border=2>

<tr>

<td> class</td>

<td>fare</td>

</tr>

<tr>

<td> <br></td>

<td><br></td>

</tr>

<tr>

<td>economy</td>
<td>10,000</td>

</tr>

<tr>

<td> <br></td>

<td><br></td>

</tr>

</table>

</html>

Main:-

<html>

<head>

</head>

<frameset rows="20%,20%,60%">

<frame src="india.html" name=frame1>

<frame src="manage.html" name=frame2>

<frame src="booking.html" name=frame3>

</frameset>

</html>

o/p:-
Q.11 write java script to design customer account details.

<HTML>

<Body>

<H1><align="center">customer account details</align></H1>

<Form name="form4" onsubmit="return valid()">

<Br>Name of Customer <input type="text" name="c">

<Br>Name of bank <input type="text" name="b">

<Br>Account no <input type="text" id="ac">

<Br>Pan no <input type="text" id="pa">

<Br><input type="submit">
</Form>

<Script>

function valid()

var x=document.form4.c.value;

var y=document.form4.b.value;

var z=document.form4.ac.value;

var p=document.form4.pa.value;

if(x=="" || y=="" || z=="" || p=="")

alert("You should have to enter any data in text field");

return false;

var letter=/^[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}$/;

if(p.match(letter))

return true;

else

alert("Please enter correct pan no");

return false;

</Script>
</Body>

</HTML>

Q.12 write a java script to compare the values of password and confirmed password.

<HTML>

<Body>

<Form name="myform" onsubmit="return validate()">

<Br>Enter User Name<input type="text" name="uname">

<Br>Enter password<input type="password" name="pas">

<Br>Enter Confirm password<input type="password" name="cpas">

<Br><input type="submit">

</Form>

<Script>

function validate()

if(document.myform.uname.value=="")

alert("Username should be filled");

return false;

if(document.myform.pas.value=="")

alert("It should be filled");

return false;

}
if(document.myform.cpas.value=="")

alert("It should be filled");

return false;

if(document.myform.pas.value.length!
=document.myform.cpas.value.length)

alert("Password and confirm password should be same");

return false;

</Script>

</Body>

</HTMl>

Q.13 Write a JavaScript program to accept user name and password from a user, if Username and
Password is same then display his score card on the next page.

<HTML>

<Body>

<h1 align="center">Dr.D.Y.patil vidy pratishtan society</h1>

<h3 align="center"> user login</h3>

<Form name="myform1">

<Br> User Name<input type="text" name="uname">

<Br> password<input type="password" name="pas">

<Br><input type="button" value="Login" onclick="validate()">


</Form>

<Script type="text/javascript">

function validate()

if(document.myform1.uname.value=="")

alert("Username should be filled");

return false;

if(document.myform1.pas.value=="")

alert("It should be filled");

return false;

if(document.myform1.uname.value=document.myform1.pas.value)

location.replace("q.13.html");

alert("successfully");

</Script>

</Body>

</HTML>

Q.14 Write a JavaScript program to read employee details and generate pay slip which will calculate
netsalary of an employee.
<html>

<body>

<script>

function netsal()

var nm=document.getElementById("ename").value;

var de=document.getElementById("dept").value;

var des=document.getElementById("desg").value;

var basal=document.getElementById("sal").value;

var hr=document.getElementById("hra").value;

var d=document.getElementById("da").value;

var n=parseInt(basal) + parseInt(hr) + parseInt(d);

document.write("The net sal is:");

document.write(n);

document.write("The name is:");

document.write(nm);

</script>

<h1><align="center">Payslip</align></h1>

<form name="myform" method="post" onsubmit="return netsal()" >

<br>Name of the employee<input type="text" name="ename" id="ename">

<br>Department:<input type="text" name="dept" id="dept">

<br>Designation:<input type="text" name="desg" id="desg">

<br>Basic Salary:<input type="text" id="sal">

<br>HRA:<input type="text" id="hra">

<br>DA:<input type="text" id="da">

<br>
<input type="submit">

</form>

</body>

</html>

o/p:-

Q.15.Write a PHP script to accept the details of employee (ename, designation, department, gender,
salary) and display it on next page.

empmain.html

<html>

<head><title>slip15</title></head>

<body>

<Pre>

<form name="fm" method="GET" action="empop.php">

Enter employee name <input type="text" name="ename"><Br>

Designation <input type="text" name="desg"><br>


Department <input type="text" name="dept"><br>

Gender <input type="radio" name="gender" value="male" >male <input type="radio"


name="gender" value"female">female<br>

Salary <input type="text" name="salary"><br>

<input type="submit" value="submit"> <input type="reset" value="reset">

</form>

</Pre>

</body>

</html>

empop.php

<?php

$ename=$_GET["ename"];

$desg=$_GET["desg"];

$dept=$_GET["dept"];

$gender=$_GET["gender"];

$salary=$_GET["salary"];

echo"name of employee: ".$ename."<br>";

echo"designation of employee: ".$desg."<br>";

echo"deparment of employee: ".$dept."<br>";

echo"gender of employee: ".$gender."<br>";

echo"salary of employee: ".$salary."<br>";

?>

Q.16 PHP script to set image to background of page.(use combo)

Image.html

<html>

<body>

<form action="q16.php" method="GET">


Select Image

<select name="img">

<option value=tower.jpg>tower.jpg</option>

<option value=dog.jpg>dog.jpg</option>

<option value=eagle.jpg>eagle.jpg</option>

<option value=photo.jpg>photo.jpg</option>

</select>

<input type=submit value=submit>

</form>

</body>

</html>

Q16.php

<?php

$image1=$_GET["img"];

echo ("<body background=$image1>");

?>
Q.17. Multiplication table

Html file-

<html>

<body>

<form action="table.php" method="post ">

ENTER A VALUE :

<form action=" table.php" method="post">

<input type="text" name="fnum" />

<input type="submit" />

</form>

</body>

</html>

Php file-

<?php

$val=$_REQUEST['fnum'];
for($i=1;$i<=10;$i++)

echo $val *$i."<br>";

?>

Q.18 change background color according to day of week.

Html file-

<html>

<body>

<form action="bp.php">

<input type="submit">

</form>

</body>

</html>

Php file-

<?php

$today=date("l");

echo("<h2>$today</h2>");

switch($today)

case "Sunday":$bgcolor="green";

break;

case "Monday":$bgcolor="blue";

break;

case "Tuesday":$bgcolor="Orange";
break;

case "Wednesday":$bgcolor="red";

break;

case "Thursday":$bgcolor="yellow";

break;

case "Friday":$bgcolor="black";

break;

default:$bgcolor="brown";

break;

echo("<body bgcolor=$bgcolor>");

?>

Q.19 php to display no into words

Html file-

<html>

<head><title>Number</title></head>
<body>

<form name="fm" method="GET" action="number.php">

Enter any number:<input type="text" name="no"><br>

<input type="Submit" value="ok">

</form>

</body>

</html>

Php file-

<?php

$n=$_GET["no"];

$no=strrev($n);

while($no > 1)

$digit= $no%10;

$no= $no/10;

switch($digit)

case "0": echo"Zero";

break;

case "1": echo"One";

break;

case "2": echo"Two";

break;

case "3": echo"Three";

break;

case "4": echo"Four";

break;
case "5": echo"Five";

break;

case "6": echo"Six";

break;

case "7": echo"Seven";

break;

case "8": echo"Eight";

break;

case "9": echo"Nine";

break;

?>

Q.20 php to count no of vowels. Show occurrence of each vowel from string.

Html file-

<html>

<body>

<h2>Find Number of Vowels in a String:</h2>

<form name="fm" action="Vowel.php" method="GET">

Enter the String:<input type="text" name="str" >

<input type="submit" value ="OK" >

</form>

</body>

</html>

Php file-

<?php
$str=$_GET["str"];

$l=Strlen($str);

echo"Length of String is :$l<br>";

$a=0; $e=0; $i=0; $o=0; $u=0; $tot=0;

for($p=0;$p<$l;$p++)

if($str[$p]=="a" || $str[$p]=="A")

$a++; $tot++;

if($str[$p]=="e" || $str[$p]=="E")

$e++; $tot++;

if($str[$p]=="i" || $str[$p]=="I")

$i++; $tot++;

if($str[$p]=="o" || $str[$p]=="O")

$o++; $tot++;

if($str[$p]=="u" || $str[$p]=="U")

$u++; $tot++;

}
echo"Total number of Vowel a is:".$a."<br>";

echo"Total number of Vowel e is:".$e."<br>";

echo"Total number of Vowel i is:".$i."<br>";

echo"Total number of Vowel o is:".$o."<br>";

echo"Total number of Vowel u is:".$u."<br>";

echo"Total number of Vowel is:".$tot."<br>";

?>

Q.21 HTML form to accept 2 numbers. Give options to choose arithmetic operations.

Write PHP function to display result on next form.

Arithmetic.html

<html>

<body>

<FORM ACTION="addition.php" method="GET">

<table>

<tr><td><h3>Enter first no :</td><td><input type=text name=no1 ></h3></td></tr>

<tr><td><h3>Enter second no :</td><td><input type=text name=no2></h3></td></tr>

<tr><td><b>Select Operation which u have to perform :</b></td></tr>

<tr><td><input type=radio value="1" name=cal>Addition</td></tr>

<tr><td><input type=radio value="2" name=cal>Substraction</td></tr>

<tr><td><input type=radio value="3" name=cal>Multiplication</td></tr>

<tr><td><input type=radio value="4" name=cal>Division</td></tr>

<tr><td></td><td><input type=submit name=submit value=Calculate></td></tr>

</table>

</form>

</body>
</html>

addition.php

<?php

$no1 = $_GET["no1"];

$no2 = $_GET["no2"];

$cal =$_GET["cal"];

if($cal==1)

$add = $no1+$no2;

echo "<h1>addition = ".$add."</h1>";

else if($cal == 2)

$sub = $no1-$no2;

echo "<h1>subtraction = ".$sub."</h1>";

else if($cal == 3)

$mult = $no1*$no2;

echo "<h1>multiplication = ".$mult."</h1>";

else if($cal == 4)

$div = $no1/$no2;

echo "<h1>division = ".$div."</h1>";

}
?>

Q.22. Strings

<html>

<head><title>Stringq22</title>

<body>

<form name="fm" method="GET"action="slip22.php">

Enter the main string<input type="text" name="s"> <br>

Find the string<input type="text" name="s1"><br>

<input type="radio" value="firstocc" name="op">first occurance<br>

<input type="radio" value="lastocc" name="op"> last occurance <br>

<input type="radio" value="wcount" name="op"> word count in string<br>

<input type="radio" value="replace" name="op"> replace string <input type="text" name="s2">

<input type="text" name="s3"><br>

<input type ="Submit" value="ok">

</form>

</body>

</html>

Php file-

<?php

$op=$_GET["op"];

$s=$_GET["s"];

$s1=$_GET["s1"];

$s2=$_GET["s2"];

$s3=$_GET["s3"];

switch($op)

{
case "firstocc" : $m=strpos($s,$s1);

echo"<br>";

echo"First occurance:";

echo"$m";

break;

case "lastocc" : $n=strrpos($s,$s1);

echo"<br>";

echo"Last occurance:";

echo"$n";

break;

case "wcount" : $c=str_word_count($s);

echo"<br>";

echo"Total no of words:";

echo"$c";

break;

case "replace" : $d=Str_replace($s2,$s3,$s);

echo"Replaced string:<br>";

echo"$d";

break;

?>

Q.23.HTML page to read value for n. Write PHP script to display first n even numbers with font
size=12,color=red and

first n odd numbers with font face=Times New Roman, size=17 and color=yellow.

oddeven.html

<HTML>
<Body>

<Form action="oeno.php" method="GET">

<Br>How many terms? <input type="Text" name=num>

<Br><input type="submit">

</Form>

</Body>

</HTML>

oeno.php

<?php

$n=$_GET["num"];

for($i=0;$i<$n;$i++)

if($i%2==0)

echo("<font size=12 color=Red>".$i."<Br>");

else

echo("<font size=17 color=Yellow face=Times New Roman>".$i."<Br>");

?>

Q.25. email validation-

<html>

<head><title>slip25</title>
</title>

<body>

<form name="fm" method="GET" action="slip25.php">

Enter Email ID<input type="text" name="email"><br>

<input type="submit" value="ok">

<input type="reset" value="clear">

</form>

</body>

</html>

<?php

$pattern = "/^[a-z0-9._]+@[a-z]+\.[a-z]{2,3}$/";

$email=$_GET["email"];

if(preg_match($pattern,$email))

echo"<br>This is Valid Email Id";

else

echo"<br>This is Invalid Email Id";

?>

Q.30 write a javascript program to display current day,date,month ,year and time on the web page
and geet the user accordingly.

<html>

<body>

<p id ="demo"> </p>

<script type="text/javascript">
var currentDate = new Date()

var day = currentDate.getDate()

var month = currentDate.getMonth() + 1

var year = currentDate.getFullYear()

var d = new Date();

var weekday = new Array(7);

weekday[0] = "Sunday";

weekday[1] = "Monday";

weekday[2] = "Tuesday";

weekday[3] = "Wednesday";

weekday[4] = "Thursday";

weekday[5] = "Friday";

weekday[6] = "Saturday";

var n = weekday[d.getDay()];

var person = prompt("Please enter your name", "abc");

if (person != null)

document.getElementById("demo").innerHTML =

"Hello " + person + "! How are you today?";

document.write("<b>" + day + "/" + month + "/" + year + "</b>"+d)

var currentTime = new Date()

var hours = currentTime.getHours()

var minutes = currentTime.getMinutes()

document.write("<b>" + hours + ":" + minutes + " " + "</b>")

</script>

</body>
</html>

You might also like