0% found this document useful (0 votes)
40 views9 pages

WP Lab Part B

The document contains 8 programs written in HTML and JavaScript. The programs demonstrate using ordered and unordered lists, confirm and prompt boxes, mouse events, converting text to uppercase, generating the Fibonacci series, and finding the reverse of a number. Each program contains the full code to display or perform the described task.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views9 pages

WP Lab Part B

The document contains 8 programs written in HTML and JavaScript. The programs demonstrate using ordered and unordered lists, confirm and prompt boxes, mouse events, converting text to uppercase, generating the Fibonacci series, and finding the reverse of a number. Each program contains the full code to display or perform the described task.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

WEB PROGRAMMING LAB (PART B PROGRAMS)

1. Write a HTML Program to display list of fruits, vegetables and


cereals using ordered list.
<html>

<head>

<title>Ordered list</title>

</head>

<body bgcolor="red">

<h4>list of fruits</h4>

<ol type="A" start="A">

<li>Strawberry</li>

<li>Fig</li>

<li>Mango></li>

<li>Pineapple></li>

</ol>

<h4>list of vegetables</h4>

<ol type ="i" start="i">

<li>tomato</li>

<li>cauliflower</li>

<li>carrot</li>

<li>beans<li>

</ol>

<h4>list of cereals</h4>

<ol type="1" start="1">


<li>rice</li>

<li>jowar</li>

<li>groundnuts</li>

<ol>

</body>

</html>

--------------------------------------------------------------------------------------------------------------------
---------
2. Write a HTML Program to display list of fruits, vegetables and
cereals using Unordered list.
<html>

<head>

<title>unOrdered list</title>

</head>

<body bgcolor="pink">

<h4>list of fruits</h4>

<ul type="disc">

<li>Strawberry</li>

<li>Fig</li>

<li>Mango</li>

<li>Pineapple</li>

</ul>

<h4>list of vegetables</h4>

<ul type ="square">

<li>tomato</li>

<li>cauliflower</li>
<li>carrot</li>

<li>beans<li>

</ul>

<h4>list of cereals</h4>

<ul type="circle">

<li>rice</li>

<li>jowar</li>

<li>groundnuts</li>

<ul>

</body>

</html>

--------------------------------------------------------------------------------------------------------------------
---------
3. Write a HTML Program to demonstrate Confirm Box.

<html>

<head>

<script type ="text/javascript">

function show_confirm()

var r =confirm ("Press a button");

if(r==true)

alert("We pressed OK!");

else
{

alert("We Pressed Cancel!")

</script>

</head>

</body>

<input type="button"onclick="show_confirm()"value="Show confirm box"/>

</body>

</html>

--------------------------------------------------------------------------------------------------------------------
---------
4. Write a HTML Program to demonstrate Prompt Box.

<!DOCTYPE html PUBLIC "_//W3C//DTD XHTML 1.0 Transitional//EN"


"http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<script type="text/javascript">

function show_prompt()

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


if(name!=null&&name!="")

document.write("Hello "+name+"! How are we today?");

}
</script>

</head>

<body>

<input type="button"onclick="show_prompt()"value="Show prompt box"/>

</body>

</html>

--------------------------------------------------------------------------------------------------------------------
---------
5. Write a JavaScript program to execute Mouse Events.
<html>

<head>

<script>

function myFunction(element, clr)

{ element.style.color = clr;

</script>

</head>

<body>

<h1 onmouseover="style.color='red'" onmouseout="style.color='black'">Get the


Mouse over this text</h1>

<h1 onmousedown="myFunction(this,'red')"
onmouseup="myFunction(this,'green')">

Click the text to change the color.<br/>A function, with parameters, is triggered
when the mouse button is pressed down, and again,<br/>

with other parameters, when the mouse button is released.

</h1>

</body>
</html>

--------------------------------------------------------------------------------------------------------------------
---------
6. Write a JavaScript program to convert Lower Case to Upper Case.
<html>
<head>
<title>To convert the text to Uppercase</title>
<script type="text/javascript">
function change_case()
{
document.form1.type.value=document.form1.type.value.toUpperCase();
}
</script>
</head>
<body onLoad="form1.type.focus();">
<center><h1>To convert the character to Uppercase</h1></center>
<form name="form1" method="post">
Enter User ID<input type="text" name="type"value="">
<input type="button" value="Change to Upper"
onclick="change_case();"></form>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------
---------
7. Write a JavaScript program to generate Fibonacci series.
<html>
<head><title>Fibonacci Series</title></head>
<body>
<script
type="text/javascript">
var var1 = 0;
var var2 = 1;
var var3;
var num = prompt("Enter the limit to generate fibonacci no",0);
document.write(var1+"<br />");
document.write(var2+"<br />");
for(var i=3; i <= num;i++)
{
var3 = var1 + var2;
var1 = var2;
var2 = var3;

document.write(var3+"<br />");
}
</script
>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------
---------
8. Write a JavaScript program to find the reverse of a given number.

<html>
<head>
<script>
function
palin()
{
var a,no,b,temp=0;
no=Number(document.getElementById("no_input").value
); b=no;
while(no>0)
{
a=no%10;
no=parseInt(no/10);
temp=temp*10+a;
}
alert(temp);
}
</script>
</head>
<body>
Enter any Number: <input id="no_input">
<button onclick="palin()">Check</button></br></br>
</body>
</html>

You might also like