You are on page 1of 10

1

ASP Practicals
1. Write a program using ASP for a web page to display the following 1 2 2 3 3 3
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf -8" /> <title>Untitled Document</title> </head> <body> <% for(i=1;i<=3;i++) { for(j=1;j<=i;j++) { Response.Write(i+ " "); } Response.Write("<br/>"); } %> </body> </html>

2. Write a program using ASP to display sum of odd numbers between 1 to 20


<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf -8" /> <title>Untitled Document</title> </head> <body> <% var i, sum; sum = 0; for(i=1;i<=20;i+=2) { sum = sum+i; } Response.Write("Sum is: " +sum); %> </body> </html>

3. Write a program using ASP to display the following using post method

<html> <% dim hobby hobby=Request.Form("hobby") %> <body> <form action="" method="post"> Name: <input type ="text" id = "name"><br/> Phone number: <input type ="text" id = "phno"><br/> Profession: <input type ="text" id = "proff"><br/> Hobies: <input type="checkbox" name="hobby" <%if hobby="reading" then Response.Write("checked")%> value="reading">reading</input> <br /> <input type="checkbox" name="hobby" <%if hobby="singing" then Response.Write("checked")%> value="singing">singing</input> <br /> <input type="checkbox" name="hobby" <%if hobby="dancing" then Response.Write("checked")%> value="dancing">dancing</input> <br /> <input type="checkbox" name="hobby" <%if hobby="drawing" then Response.Write("checked")%> value="drawing">drawing</input>

4
<br /> <br /> <input type="submit" value="Submit" /> </form> <% if hobby<>"" then Response.Write("<p>Your Hobbies are: " & hobby & "</p>") end if %> </body> </html>

4. Write a ASP program to accept the number from the user and do the following - Calculate Fibonacci series

- Calculate Armstrong

5. Write a program using ASP to display the following using post method

<html> <% dim user dim nm dim ag user=Request.Form("gender") nm = Request.Form("fname") ag = Request.Form("age") %> <body> <form action="" method="post"> Name: <input type ="text" id = "fname" name = "fname"><br/> Age: <select name="age"> <option value=""></option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> </select> <br/> Gender: <input type="radio" name="gender" value="Male">Male</input> <br />

8
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;< input type="radio" name="gender" value="Female">Female</input> <br /> <input type ="Submit" value = "Submit" name ="b1"> <input type ="button" value = "Reset" name ="b2"> </form> <% if user <> "" then Response.Write("<p>Your name is: " & nm & "</p>") Response.Write("<p>Your Age is: " & ag & "</p>") Response.Write("<p>Your Gender is: " & user & "</p>") end if %> </body> </html>

6. Write a ASP program which accepts name on first page and surname on 2nd page. Display the result on the 3rd page using cookie tracking.

10

7. Write an ASP program to accept the image information such as width, height, text color, text string & shape and store in image table

You might also like