Program File XII
-
Upload
sahil-rajput -
Category
Documents
-
view
227 -
download
2
description
Transcript of Program File XII
Name: ALEENA AHMED
Roll no:
Q1. Write a HTML Code for school website
Code: <HTML> <FRAMESET ROWS="40%,*"> <FRAME SRC="C:\Users\gangauly\Desktop\Frameset- school website\one.html"> <FRAMESET COLS="40%,*"> <FRAME SRC="C:\Users\gangauly\Desktop\Frameset- school website\second.html"> <FRAME SRC="C:\Users\gangauly\Desktop\Frameset- school website\third.html"> </FRAMESET> </FRAMESET> </HTML> one.html <HTML> <HEAD><TITLE>SCHOOL</TITLE></HEAD> <BODY BACKGROUND="C:\Users\gangauly\Desktop\neha\light.jpg" LINK=blue ALINK=red VLINK=purple> <H1><CENTER>WELCOME TO LITTLE FLOWER</CENTER></H1> <HR WIDTH=70% SIZE=5 COLOR=RED NOSHADE><P> <CENTER><IMG SRC="C:\Users\gangauly\Desktop\neha\flower.jpg" WIDTH=20% BORDER=10></CENTER> </HTML> Coding for second.html <HTML> <HEAD><TITLE>SCHOOL</TITLE></HEAD> <BODY BACKGROUND="C:\Users\gangauly\Desktop\neha\light.jpg" LINK=blue ALINK=red VLINK=purple> <FONT FACE="Comic Sans Ms" COLOR=BLUE SIZE=5><P> The Little Flower Enjoy The Following Activities <FONT FACE="Comic Sans Ms" COLOR=PURPLE SIZE=5> <OL TYPE=I> <A HREF="in.html"><LI>Indoor Activities</A> <UL TYPE=circle> <A HREF="C:\Users\gangauly\Desktop\Frameset- school website\painting.HTML"><LI>Painting</A> <A HREF="C:\Users\gangauly\Desktop\Frameset- school website\clay.HTML"><LI>Clay Modeling</A> </UL> <A HREF="out.html"><LI>Outdoor Activities</A> <UL TYPE=circle> <A HREF="C:\Users\gangauly\Desktop\Frameset- school website\swimming.HTML"><LI>Swimming</A>
<A HREF="C:\Users\gangauly\Desktop\Frameset- school website\horse.HTML"><LI>Horse Riding</A> </UL> </OL> <P></FONT> </BODY> </HTML> painting.html <HTML> <H1><FONT SIZE=7 ><CENTER>PAINTING</FONT></CENTER></H1> <BODY BACKGROUND="C:\Users\gangauly\Desktop\neha\paint.jpg" WIDTH="50%" HEIGHT="50%"> <FONT SIZE=6 COLOR=WHITE>Painting is a mode of creative expression, and the forms are numerous. Drawing, composition or abstraction and other aesthetics may serve to manifest the expressive and conceptual intention of the practitioner. Paintings can be naturalistic and representational (as in a still life or landscape painting), photographic, abstract, be loaded with narrative content, symbolism, emotion or be political in nature..</FONT> </BODY> </HTML> clay.html <HTML> <H1><FONT SIZE=7 color=ORANGE ><CENTER>CLAY MODELLING</FONT></CENTER></H1> <BODY BGCOLOR=GREEN> <IMG SRC="C:\Users\gangauly\Desktop\neha\clay.jpg" WIDTH="50%" HEIGHT="50%"> <FONT SIZE=6 COLOR=YELLOW>Clay modeling (or clay model making) for automobile prototypes was first introduced in the 1930s by automobile designer Harley Earl, head of the General Motors styling studio (known initially as the Art and Color Section, and later as the Design and Styling Department). Industrial plasticine, or "clay", which is used for this purpose, is a malleable material that can be easily shaped, thus enabling designers to create models to visualize a product. Clay modeling was soon adopted throughout the industry and remains in use today.</FONT> </BODY> </HTML> swimming.html <HTML> <H1><FONT SIZE=7 COLOR=PURPLE><CENTER>SWIMMING</FONT></CENTER></H1> <BODY BACKGROUND="C:\Users\gangauly\Desktop\neha\swimmer.jpg" > <FONT SIZE=6>The sport of swimming has been recorded since prehistoric times; the earliest recording of swimming dates back to Stone Age paintings from around 7,000 years ago. Written references date from 2000 BC. Some of the earliest references to swimming include the Gilgamesh, the Iliad, the Odyssey, the Bible, Beowulf, The Holy Quran along with others. In 1538, NikolausWynmann, a German professor of languages, wrote the first swimming book, The Swimmer or A Dialogue on the Art of Swimming (Der SchwimmerodereinZweigesprächüber die Schwimmkunst). Swimming emerged as a competitive sport in the 1830s in England. In 1828, the first indoor swimming pool, St George's Baths was opened to the public.[1] By 1837, the National Swimming Society was holding regular swimming competitions in six artificial swimming pools, built around London. The sport grew in popularity and by 1880, when the first national governing body, the Amateur Swimming Association, was formed, there were already over 300 regional clubs in operation across the country.</FONT> </BODY>
</HTML> Coding for horse.html <HTML> <H1><FONT SIZE=7 COLOR=GREEN><CENTER>HORSE RIDING</FONT></CENTER></H1> <BODY BACKGROUND="C:\Users\gangauly\Desktop\neha\HORSE.jpg" WIDTH="50%" HEIGHT="50%"> <FONT SIZE=6>Equestrianism (from Latin equester, equestr-, horseman, horse)[1] more often known as riding, horseback riding (American English) or horse riding (British English) referring to the skill of riding, driving, steeplechasing or vaulting with horses. This broad description includes the use of horses for practical working purposes, transportation, recreational activities, artistic or cultural exercises, and competitive sport.</FONT> </BODY> </HTML> Coding for third.html <HTML> <HEAD><TITLE>SCHOOL</TITLE></HEAD> <BODY BACKGROUND="C:\Users\gangauly\Desktop\neha\light.jpg"><FONT FACE="Comic Sans Ms" SIZE=5><CENTER>School Timings <TABLE BORDER=5 BORDERCOLOR=GREEN WIDTH=50% HEIGHT=100 CELLSPACING=6 CELLPADDING=6> <TR BGCOLOR=YELLOW ALIGN=CENTER> <TH>Facilities <TH>Summer Timings <TH>Winter Timings <TR ALIGN=CENTER BGCOLOR=PINK> <TD>Junior School <TD>9:00am To 12:30pm <TD>9:30am To 1:00pm <TR ALIGN=CENTER BGCOLOR=LIGHTGREEN> <TD>Hobby Club <TD>5:00pm To 7:00pm <TD>4:30pm To 6:30pm </TR> </TABLE> </CENTER></FONT><P> <HR WIDTH=100% SIZE=5 COLOR=PURPLE NOSHADE><P> <FONT FACE="Comic Sans Ms" SIZE=3 COLOR=BLUE> <CENTER><A HREF="mail to:[email protected]">Contact Us At:[email protected]</A></CENTER> </FONT> </BODY> </HTML> OUTPUT:
Q2. Write a HTML code to increase the size of the image 150 x150
to 300 x 300 when the mouse is moved over the image.
CODE:
<html>
<head>
<script Language = VBScript>
subimgchg
Window.document.image1.height = 300
Window.document.image1.width = 300
end sub
sub imgchg1
Window.document.image1.height = 100
Window.document.image1.width = 100
end sub
</script>
<body>
<imgsrc = " Rashtrapati-Bhawan-delhi.jpg" height = 100 width =100 name = image1
onMouseover=imgchg() onMouseout=imgchg1()>
</head>
Output:
Q3. Write a VBScript code to display largest number among three
numbers.
Code: <HTML> <HEAD> <SCRIPT LANGUAGE="VBScript"> dim num1,num2,num3 num1=inputbox("enter number 1") num2=inputbox("enter number 2") num3=inputbox("enter number 3") if num1>num2 and num1>num3 then msgbox "num1 is greater"& num1 else if num2>num1 and num2>num3 then msgbox "num2 is greater"& num2 else if num3>num1 and num3>num2 then msgbox "num3 is greater"& num3 end if end if end if </script> </HEAD> </HTML>
OUTPUT:
Q4. Write an HTML code to make a word editor .
<HTML> <HEAD></HEAD> <SCRIPT LANGUAGE="VBScript"> Sub Rcolor() document.BGcolor=RGB(0,0,255) document.f1.t1.style.Color=RGB(0,0,255) end sub Sub Bcolor() document.BGcolor=RGB(255,0,0) document.f1.t1.style.Color=RGB(255,0,0) end sub Sub Gcolor() document.BGcolor=RGB(0,255,0) document.f1.t1.style.Color=RGB(0,255,0) end sub Sub Ycolor() document.BGcolor=RGB(0,255,255) document.f1.t1.style.Color=RGB(0,255,255) end sub Sub alertdisp() document.f1.t1.style.fontweight="900" end sub Sub italicdisp() document.f1.t1.style.fontStyle="italic" end sub Sub undisp() document.f1.t1.style.TextDecoration="underline" end sub </script> <FORM NAME=f1> <H1><CENTER><FONT FACE="Jokerman" COLOR="Aqua">Word Editor</FONT></CENTER></H1> <H2>Enter Your Text Here: <input type=text id="txt1" name=t1></H2> <BR> <BR> <TABLE BORDER=3 ALIGN=LEFT BORDERCOLOR=PURPLE WIDTH=200 HEIGHT=250> <TR> <TD><INPUT TYPE="radio" NAME="R1" ONCLICK=Rcolor() >Red<BR> </TR> <TR> <TD><INPUT TYPE="radio" NAME="R1" ONCLICK=Gcolor() >Green<BR> </TR> <TR> <TD><INPUT TYPE="radio" NAME="R1" ONCLICK=Bcolor() >Blue<BR> </TR> <TR> <TD><INPUT TYPE="radio" NAME="R1" ONCLICK=Ycolor() >Yellow<BR> </TR> </TABLE> <TABLE BORDER=3 ALIGN=CENTER BORDERCOLOR=PURPLE WIDTH=200 HEIGHT=250>
<TR> <TD><INPUT TYPE="checkbox" NAME=CH1 ONCLICK=alertdisp()>Bold<BR></TR> <TR> <TD><INPUT TYPE="checkbox" NAME=CH2 </TR> <TR> <TD><INPUT TYPE="checkbox" NAME=CH3 ONCLICK=undisp()>Underline<BR></TR> </TABLE> <BR> <BR> <INPUT TYPE="Reset" VALUE="Reset" ></FORM> </TABLE> </HTML>
OUTPUT:
Q5. Write an HTML Code to display
<html>
<script language = VBScript>
dim n
n=5
fori=1 to n step 1
for k=n to i step -1
<TD><INPUT TYPE="checkbox" NAME=CH1 ONCLICK=alertdisp()>Bold<BR>
<TD><INPUT TYPE="checkbox" NAME=CH2 ONCLICK=italicdisp()>Italics<BR>
<TD><INPUT TYPE="checkbox" NAME=CH3 ONCLICK=undisp()>Underline<BR>
<INPUT TYPE="Reset" VALUE="Reset" >
Q5. Write an HTML Code to display diamond .
<script language = VBScript>
<TD><INPUT TYPE="checkbox" NAME=CH1 ONCLICK=alertdisp()>Bold<BR>
ONCLICK=italicdisp()>Italics<BR>
<TD><INPUT TYPE="checkbox" NAME=CH3 ONCLICK=undisp()>Underline<BR>
document.write ("-")
next
for j=1 to i step 1
document.write("*" & " ")
next
document.write("<br>")
next
fori=n to 1 step -1
for k=ito n step 1
document.write ("-")
next
for j=1 to i step 1
document.write("*" & " ")
next
document.write("<br>")
next
</Script>
</html>
Q6. Write a subroutine that takes a string as argument and checks whether the
given string is palindrome or not.
CODE:
<%
sub palindrome(str)
for k = len(str) to 1 step-1
rev = rev+mid(str,k,1)
next
ifstr = rev then
response.write(str& " " &"is a palindrome")
else
response.write(str& " " &"is not a palindrome")
end if
end sub
%>
<body>
<% call palindrome("malayalam")%>
</body>
Q7. Write a sub routine that takes a string containing the name of a person as
argument and displays it in the following format.
<%
subformattxt(str)
name = Ucase(Left(str,1))
for k=2 to Len(str)
if Mid(str,k,1)= " " then
name = name+Mid(str,k,1)+Ucase(Mid(str,k+1,1))
k=k+1
else
name = name +Lcase(Mid(str,k,1))
end if
next
response.write(name)
end sub
%>
<body>
<% a = "variable passed to a asp procedure" %>
<%call formattxt(a)%><br>
<%call formattxt("string argument passed to asp procedure")%>
</body>
Output:
Q8. Create an ASP file to display the ads stored in the rotator schedule file called
ads.txt. The file should contain 3 different GIF files, each linked to a separate web
page of your choice. Also give weightage to each of the ads.
Ads.txt
Redirect Adrotatorredirect.asp
width 420
height 50
border 0
*
Tutorial\images\office_logo.gif
http://www.gmail.com
welcome to gmail home page
50
Tutorial\images\bnrwinfam.gif
http://www.gmail.com
welcome to gmail home page
30
Test.asp
<html>
<body>
<%
setmyad=server.CreateObject("MSWC.AdRotator")
Response.Write(myad.GetAdvertisement("ads.txt"))
%>
</body>
</html>
Output:
Q9. Create an ASP code using Counter components to conduct the opinion poll.
Global.asa
<OBJECT RUNAT=server SCOPE=Application ID=mycount
PROGID="MSWC.Counters"></OBJECT>
Vote.asp
<html>
<head><title> Opinion Poll </title></head>
<body>
<%
vote= Request.QueryString("choice")
if vote ="romance" then
mycount.Increment("rcounter")
end if
if vote ="action" then
mycount.Increment("acounter")
end if
if vote ="drama" then
mycount.Increment("dcounter")
end if
if vote ="comedy" then
mycount.Increment("ccounter")
end if
%>
<h2> Opinion Poll:</h2>
<b> Select a kind of movie you like to watch;</b><br>
<form name ="voting" Method="GET" Action="vote.asp">
<input type ="checkbox" name="choice" value="romance"> Romance
<input type ="checkbox" name="choice" value="action"> action
<input type ="checkbox" name="choice" value="drama"> drama
<input type ="checkbox" name="choice" value="comedy"> comedy
<br><input type ="submit" value="submit vote">
</form>
<br>
votes for Romance<%=mycount.Get("rcounter")%><br>
votes for Action<%=mycount.Get("acounter")%><br>
votes for Drama<%=mycount.Get("dcounter")%><br>
votes for Comedy<%=mycount.Get("ccounter")%><br>
<br><b>No. of people who voted:
<%=mycount.Increment("pgcount")%> times</center>
</body>
</html>
Output:
Q10. Write a program to read a text file name abc.txt and count the number of
words, lines and characters in the file.
<%
Dim words , lines, chars, ch
Set FileObj = Server.CreateObject("Scripting.FileSystemObject")
Set MyFile=FileObj.OpenTextFile("c:\abc.txt")
While NOT MyFile.AtEndOfStream
ch= MyFile.Read(1)
chars=chars+1
ifch=" " then
words=words+1
Elseifch="."Or ch="?" Or ch="!" then
lines = lines+1
end if
Wend
Response.write("No of character" & chars &"<br>")
Response.write("No of words" & words &"<br>")
Response.write("No of lines" & lines &"<br>")
MyFile.close
%>
Output:
Q11. Write the ASP code to perform the following operations using ADO:
a) Add a new record into the Customer table using a form, which takes input
form the user for all the details in the Customer table.
Demo_add.asp
<html>
<body>
<form method="post" action="demo_add2.asp">
<table>
<tr>
<td>CustomerID:</td>
<td><input name="custid"></td>
</tr><tr>
<td>Company Name:</td>
<td><input name="compname"></td>
</tr><tr>
<td>Contact Name:</td>
<td><input name="contname"></td>
</tr><tr>
<td>Address:</td>
<td><input name="address"></td>
</tr><tr>
<td>City:</td>
<td><input name="city"></td>
</tr><tr>
<td>Postal Code:</td>
<td><input name="postcode"></td>
</tr><tr>
<td>Country:</td>
<td><input name="country"></td>
</tr>
</table>
<br><br>
<input type="submit" value="Add New">
<input type="reset" value="Cancel">
</form>
</body>
</html>
<html>
<body>
Demo_add2.asp
<%
set conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\InetPub\wwwroot\database\db1.accdb;Persist Security Info=False;"
conn.Open
sql="INSERT INTO dbc(customerID,customername,"
sql=sql& "contactname,address,city,postalcode,country)"
sql=sql& " VALUES "
sql=sql& "('" &Request.Form("custid") & "',"
sql=sql& "'" &Request.Form("compname") & "',"
sql=sql& "'" &Request.Form("contname") & "',"
sql=sql& "'" &Request.Form("address") & "',"
sql=sql& "'" &Request.Form("city") & "',"
sql=sql& "'" &Request.Form("postcode") & "',"
sql=sql& "'" &Request.Form("country") & "')"
on error resume next
conn.Executesql,recaffected
if err<>0 then
Response.Write(err.Description& "<br><br>")
else
Response.Write("<h3>" &recaffected& " record added</h3>")
end if
conn.close
%>
Output:
Demo_add.asp
Q12. Build an ASP page that asks the user whether they want to go to any three
different web sites of your choice. Once they have made a selection redirect them
to the appropriate page by using a Select case statement.
Choice.asp
<html>
<head>
<title> Choice</title></head>
<body>
<p> Which site do you want to go to?</p>
<p><a href ="choicenext.asp?choice=Y"> Yahoo</a></p>
<p><a href ="choicenext.asp?choice=G"> Google</a></p>
<p><a href ="choicenext.asp?choice=H"> Hotmail</a></p>
</body>
</html>
Choicenext.asp
<html>
<head>
<title> Favourite site</title></head>
<body>
<%
fch = request.QueryString("choice")
select case fch
case "Y"
response.redirect "http://yahoo.com"
case "G"
response.redirect "http://gmail.com"
case "H"
response.redirect "http://hotmail.com"
end select
%>
</body>
</html>
Output:
Q13. Write a code to generate the following output.
S
Se
Seni
Senio
Senior
Code:
<html> <head> <script language = "VBScript"> dimstr str= "Senior" document.write(a) fori =1 to len(str) document.write(left(str,i) & "<br>") next </script> </head> </html>
Q14. Write a program to generate a random number between 0 to 99
Code:
<html>
<body>
<%
Randomize()
randomNumber=Int(100 * Rnd())
response.write("A random number: <b>" &randomNumber& "</b>")
%>
</body>
</html>
Output:
Q15. Write a program to display month name.
Code:
<html>
<body>
<p>VBScripts' function <b>MonthName</b> is used to get a month:</p>
<%
response.Write(MonthName(1))
response.Write("<br>")
response.Write(MonthName(2))
%>
<p>Abbreviated name of a month:</p>
<%
response.Write(MonthName(1,true))
response.Write("<br>")
response.Write(MonthName(2,true))
%>
<p>Current month:</p>
<%
response.Write(MonthName(month(date)))
response.Write("<br>")
response.Write(MonthName(month(date), true))
%>
</body>
</html>
Output:-
Q16. Write a code to display the sum of a four digit no.
Code:<html>
<script language = "vbscript">
dimnum , sum
num = inputbox("enter a four digit number")
sum =0
fori = 1 to 4 step 1
sum = sum+num mod 10
num = num\10
document.write("sum" & sum )
document.write("<BR>")
next
</script>
</html>
Output:
Q17. Write a ASP code to display a factorial of number given by user.
Code:
<html>
<body>
<form method = post>
Enter a number:<input type = text name = "t1">
</form>
</body>
<%
num = Request.Form("t1")
fact =1
for a =1 to num
fact= fact* a
next
response.write(fact)
%>
Output:
Q18. Write a code in VBScript to check whether a user is eligible to vote or not.
Code:
<head>
<script language = vbscript>
dim age
age = inputbox ("Enter your age")
if age>= 18 then
msgbox "You are eligible to vote"
else
msgbox "You are not eligible to vote"
end if
</script>
</head>
Output:
Q19. Write the code to generate the above page and write the event handlers to
display the appropriate answer when each button(+,-,*,/) is clicked.
Code:
<HTML>
<HEAD>
<script language = vbscript>
sub add
document.f1.t3.value = cint(document.f1.t1.value) +cint(document.f1.t2.value)
end sub
sub minus
document.f1.t3.value = cint(document.f1.t1.value) - cint(document.f1.t2.value)
end sub
sub div
document.f1.t3.value = cint(document.f1.t1.value) / cint(document.f1.t2.value)
end sub
submul
document.f1.t3.value = cint(document.f1.t1.value) * cint(document.f1.t2.value)
end sub
</script>
<form name = "f1">
Enter first number: <input type = text name = "t1"><br>
Enter second number: <input type = text name = "t2"><br>
Result: <input type = text name = "t3"><br>
<input type = button name = b1 value = "+" onClick = add()>
<input type = button name = b2 value = "-" onClick = minus()>
<input type = button name = b3 value = "/" onClick = div()>
<input type = button name = b4 value = "*" onClick = mul()>
</form>
</html>
Output:
Q20: Write the code to generate the page based on the user’s choice (Display the
size and the colour of T-shirt chosen by the user in a message box).
Code:
<Html>
<head> <title> Select size and color</title>
<Script language = vbscript>
sub chksize(s1)
msgbox "you have selected " & s1 & " "&"size"
end sub
sub chkcolor(col)
msgbox "you have selected " & col & " "&"color"
end sub
</script>
</head>
<body>
<form name= "f1">
<h1> Select your T-shirt Size</h1>
<input type = Radio name = "r1" onClick="chksize('small')">Small <br>
<input type = Radio name = "r1" onClick="chksize('Medium')">Medium <br>
<input type = Radio name = "r1" onClick="chksize('Large')">Large <br>
<input type = Radio name = "r1"onClick="chksize('X-large')">X-Large <br>
<h1> Select your T-shirt Color</h1>
<input type = Checkbox name = c1 value = "Black" onClick="chkcolor('black')"> Black <br>
<input type = Checkbox name = c2 value = "while" onClick="chkcolor('White')"> White
</form>
</body>
</html>
Output:
Q21. Write a code for both the style sheet and HTML document.
Code:
<HTML> <HEAD> <LINK REL="Stylesheet" TYPE="text/css" HREF="HA.CSS"> <STYLE TYPE="text/css"> H1 {FONT-FAMILY:Times New Roman; COLOR:magenta} </STYLE> </HEAD> <BODY> <H1> Cascading Style Sheets </H1> <DIV STYLE="COLOR:red; FONT-SIZE:25px">Cascading Style Sheets can be used in 3 ways:</DIV> <DIV STYLE="COLOR:Green; FONT-SIZE:20px"><OL TYPE="1"> <LI>Inline <LI>Internal linking <LI>External linking </OL> </DIV> <P STYLE="COLOR:Blue;BACKGROUND:Yellow">Inline styles are used to add style to a particular tag or group of tags.The style information is included within the tag of an HTML element.</P> <P><B>External Style Sheet</B> </BODY> </HTML> EXTERNAL FILE B {COLOR:White;BACKGROUND-IMAGE:url(C:\Users\gangauly\Desktop\neha\Blue.jpg) ;FONT-SIZE:"600%"}
Output:
Q22. Write a program to check even or Odd number.
Code:
<html>
<head>
<script language = "vbscript">
dimnum
num = inputbox("Enter a number")
if (num Mod 2)= 0 then
msgbox "number is even"
else
msgbox "number is odd"
end if
</script>
</head>
</html>
Output:
Q23. Write an ASP code to store the names of 10 people into an array and display
the names of all those people whose name begins with the letter “A”.
Code:
<%
dim names(4)
names(0) = "Alka"
names(1) = "Ram"
names(2) = "Arpana"
names(3) = "Sanjeev"
names(4) = "Alok"
for k = 0 to 4
if left(names(k),1) ="A" then
response.write(names(k) & "<br>")
end if
next
%>
Output:
Q24. Create a Flash Animation to display rotating Globe.
Code:
Output: