12 TH Science Sop 7 Till Last

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Coding :

<body>
</head>
</title>Colors<title> visiblyafter Create status
automatically bar.visibly
button shouldObjects.
tirst SOP
Background <head>
<html>color.html
<!DOCTYPEhtm> alert
message the button
another
distinct page object
distinct :Create 1
change Write

should getsafter object


is
webbackgroundafter code a
background clicked, web
loaded
without
be every page every using page
displayed. appropriate JavaScript
seconds.inusing
in
colors. the colors
clicking,Javascript
seconds. HTML 2.
browser.
JavaScript
When This excluding such
having
message There the
the eventwhere
There color that
page should
the
should when white a
shouldmust of
the default
is the the
background
be at
background
unloaded, at be least
background mouse
least displayedcolor.
triggered
be
be When is
the 7 placed and
7
different color
automatically different
appropriate inthe of two
changesBrowsers
the over
second Button
and andpage the

W
P-21 SOP HAND BOOK
TPS Information Technology (Science)

<hlalign="center">7 Different &visibly distinct background colors</h1>


<form name="frm1">
<center>

<input type="button" name-"btncolor" value="Change Colors"


onMouseOver="1()">
<input type="button" name="btnmsg" value="Message Display" onClick='msg)">
</form>
</body>
<script type="text/javascript"'>
function f1) -

document.bgColor="red";
window.setTimeout("f2()",1500);

function f2()

document.bgColor="green'";
window.setTimeout("f3()",1500);

function f3()

document.bgColor-"pink";
window.setTimeout("f4)",1500);

function f4)

document.bgColor="orange";
window.setTimeout("5()"1500);

function f5()
TIS Intormation Technology (Science) P22 SOP HANDBOOK

document.bgColor="skyblue";
window.setTimeout("fe0" 1500):
function fo)

document.bgColor="voilet";
window.setTimeout("70",1500);
function f70)

document.bgColor="aqua";
window.setTimeout("f1()",1500);
function msg)

window.status="Display of 7 different colors";

</script>
</html>
TPS intormation Technology (Science) P23
PHANOO%
colorl.html
DOCTYPE html>
<html>
head>
<title>

Background Colors
</titles
</head
<body onLoad="f1(0" onUnload="msg)">
<hl align="center">7 Different &visibly distinct background colors</hl>
</body>
<script type="text/javascript">
function f1()

document. bgColor="'red";
window.setTimeout("f20",1500);

function f2()

document.bgColor='"green";
window.set Timeout("f3(0",1500);

function f3()

document. bgColor="pink";
window.setTimeout("f40",1500);

function f4)

document.bgColor="orange";
window.setTimeout("50",1500);

function f5)
TPS Information Technology (Science) P-24 SOP HAND BOOK

document.bgColor="'skyblue":
window.setTimeout("f6()",1500);

function f6()

document.bgColor="voilet";
window.setTimeout("f7()",1500);

function f7()

document.bgColor="'aqua";
window.setTimeout("f1()",1500);

function msg)

alert("Display of 7 different colors");

</script>
</html>

Output:

7Different & visibly distinct


background colors

essagefromwebpaige

Display of 7 different coiors


TPS Information
Technology (Science) P-25
SOP 2 : Create SOP HAND BOOK
of HTML5 JavaScript
properties to doprogram
for the
following :form validations. Make use
the following
1)
Name, address, contact number and validations
2)
Address field should show the hintemail are required fields of the
value which will disappear when form.
gets focus or key press field
3) event.
Telephone number should be maximum 10 digit
4) Email field should contain number only.
and not at the beginning or atvalid email address, @
end. It must contain atshould appear only once
5) least one dot(.).
Make use of pattern attribute for email to
alphabets, digits and specified symbols. accept lowercase, uppercase

Information Form
Your Name:

peEDenant addres

Address

Contact:

E-mail:

Submit

Coding :
email.html
<html>
cbody>
<form name="frm1">
Enter Name
<input type="text" name="t1"><br><br>
Enter Address<br>
<textareaname="t2" placeholder="PERMENANT
ADDRESS"></textarea><br><br>
Enter Telehpone Number
<input type="tel" maxlength="10"><br><br>
Enter Email Address
pattern="[A-Z a-z]|5)-(@]{1}--J1}"
<inputtype="'email" name="3"'
placeholder="lax2107@gmail.com"><br><br>
value="Submit" onClick="chk0">
<input type="button" name="b1"
</form>
</body>
TPS Information Technology
(Science) P-26 SOP HAND BOOK

<script type="text/javascripe">
function chk()

var x=frm1.t3.value;
var atpos=x.indexOf("@");
var lastat=x.lastIndexOf("@");
var firstdot=x.indexOf(".");
var dotpos =x.lastlndexOf(".");

if(atpos<1| ldotpos<atpos+21 l dotpos+2>=x.length I Ifirstdot<atposl latpos<lastat)


alert("Not avalid email address");
frm1.t3.focus();
else

alert("Emailaddress is accepted");
return true;

</script>
</html>
Output :
emaittm! +

- ’C File EyX19%20SCI%Z017%202020-21/SOP%,20/avaScript/SOP2/email. htmi


Enter Name Laxm1 Jeswani This page says
Enter Address Emal aodress is accepted

Musbai

Enter Telehpone Number 8543698523

Enter Email Address la2107@gmail con

Submit
P-27 SOP HAND BOOK
TPS Information Technology (Science)
SOP 3 : Create event driven JavaScript program for the following. Make use of
appropriate variables, JavaScript inbuilt string functions and control structures.
To accept string from user and count number of vowels in the given string.
Coding :
<!DOCTYPE html>
<html>
<head>
<title>
String functions
</title>
</head>
cbody>
<form name="frm1">
Enter Your Name
<input type="text" name="t1"><br><br>
name="btncheck" value="Count Vowels" onClick="cnt()">
<inputtype="button"
</form>
</body>
<script type="text/javascript">
function cnt()

var s,i,ch,c;
c=0;
s=frm1.t1.value;
for(i-=0;j<=s.length;i++)

ch=s.charAt(i); |ch--"i" | | ch=="0"


|ch=="E" Ich=="e" | | ch=="
if(ch=="A" I | ch=="a" ||ch==u")
|Ich==o" | lch="U"
C++;

"+c);
alert("Number of Vowels in string are

</script>
</html>
TPS Information Technology (Science) P-28 SOP HAND BOOK

Output:
1elEXI SCIT 2020-21150P ¢ Search.

String functiens
Enter Your Namne iaxmi

Count Vowels

Message from webpage

Number cf Vowels in string are 2

Ok

100%

SOP 4 :Create event driven JavaScript program for the following. Make use of
appropriate variables, JavaScript inbuilt string functions and controlstructures.
To accept string from user and reverse the given string and check whether it is
palindrome or not.
Coding :
palindrome.html
<!DOCTYPEhtml>
<html>
<head>
<title>
Palindrome
</title>
</head>
<body>
<form name="frm1">
Enter Your Name
<input type="text" name="t1"><br»<br>
<inputtype="button" name="btncheck" value="Check Palindrome"
onClick="chk()">
</form>
</body>
<script type="text/javascripe"'>
function chk()

var a,s,i,ch,n;
TPSInformaion Technology (Science) P-29 SOP HAND BOOK

a=frm1.t1.value;
s=a.toLowerCase();
n=s.length;
var p=1;
for(i=0; i<n/2;i++)

if(s.charAt(i)!= s.charAt(n-1-i)
p=0;
break;

if(p==1)
alert("String is Palindrome");
else
alert("String is not a Palindrome");

</script>
</html>
0
Output : ta X

e)EXM SCI n 2020-21\50P - cSearch..


Palindrome

Enter Your Name Dad

Check Palindrome

Message from

String is Palindrome

OK

100%
Coding:
PHPUse program SOP
UseMinimum
functions.
action='age.php">
method="post"
age"><br><br>
type-"text"
<input Enter age.html
Yourage <form <hlcbody><html>
Decision
align="center">Person should :1
age Write
making required
include a PHP

statement. program
3.
for the
Server-Side
vote
following
Eligible
to
is check
18.
to
vote Scripting
if
a
or person
not</hl>
(PHP)
is
eligible

to
vote
or
not.
The
TPSInformation
Technology (Science) P-36 SOP HAND BOOK TP

<inputtype="submit" name="submit" value="Check Eligible'>


</form> </body>
</html>
age.php
<?php
if(isset($_POST['submit'|))
Sage =$_POST['age'];
if(Sage>=18)
echo "<br><br>You are Eligible to vote";
else
echo "<br><br>You are not Eligible to vote";

?>

Output:
aqe.htrni X

File C/xampp/htdocs/php/..

Person Eligible to vote or not


Enter Your age 54

Check Elgible

SOP 2 : Write a PHP function to count the total number of


vowels (a,e,i,o,u) from
the string, Accepta string by using HTML form.
Coding :
vowel.html
<html>
<body>
<hl align="center">String Functions</hl>
<form method="pose" action="vowel.php">
Enter Sring
<input type='text" name='str"><br><br>
<input type="'submit" name="'submit" value="Count Vowels"
</form>
P-37 SOP HAND BOOK
TPSintormation Technology (Science)
</body>
</html>
vowel.php
<?php
if(isset($_POST|'submit'))

$str = strtolower($_POST['str']);
Svowels =array('a',e,",o,u);
$len = strlen($str);
Snum = 0;
for($i=0; $i<$len; $i++){
if(in_array($str[$i], $vowels))

$num+t;

echo "Number of vowels :.$num";


}
?>

Output: Search.
C:\xampp\htdocs\ php\S
Cxampp\htdocs\php\SO... x

String Functions
Enter Sring laxmi

Count Vowels

100%

operations on an
SOP 3 : Write a PHP program to perform the following
associative array.
Display elements of an array along with their keys.
Display the size of an array.
Delete an element from an array from the given index.
P-38
ANDBOOK
Coding :
array.php
<?php
$m1=
array("English"=>"55",
"Hindi"=>"60",
"Maths"=>"70",
"Marathi"=>"85"):
echo "<br><br><b>Elements of an array along with their keys :</b>;
echo "<br> <br> Your score".$m1['English']. " in English";
echo "<br> <br> Your score".$m1[Hindi']."in Hindi";
echo "<br> <br> Your score".$ml['Maths']. " in Maths";
echo "<br> <br Your score".Sm1['Marathi'l. " in Marathi";
echo "<br><br><b>Size of an array is :</b>".count(m1);

array_splice($m1,0,1);
echo "<br><br><b>After deleting array is :</b>";
foreach($m1 as $x => $x_value)

echo"<br><br»Key=".$x.", Value=" .$x_value;


echo "<br>";

?>

Output : locainost/php/SOP3/array.php

O locaihost/php/SOP3/array.php

Elements of an array along with their keys :


Your score 55 in English
Your score 60 in Hin i

Your score 70 in Maths

Your score 85 in Marathi

Size of an array is 4

After deleting array is :


Key=Hindi, Value=60

Key=Maths, Value=70

Key=Marathi, Value-85
BOOK
AND

Output :
Coding : TPS
Intormation
?>
"<br><br>
echo $t=$t+$a[$x];
echo
$p=$t100/500; echo along and SOP
$c=count($a); $x=0;$t=0;
for($x=0;$x<$c;$x
++) <?php
marks.php:
(60,78,74,85,96);
$a=array
"<br><br> "<br><br> Information
with 4
enatge 1s
Toral Marks
is Marks
subject.74
Marks inMarkslocaihost/php/sCP4/marks
subject.78 Marks
in 3 :
Write
Technology
in in in total
.393 subjectsubject subject
a
78.6 Percenatge Total Marks marks
96 .85 .60 Technology PHP(Science)
localhost/php/SOP4/marksl.php
is in andprogram
l.php x :.$t";
subject
is percentage.
$p"; : in to
.$a[$x]"; an
save
P-39
array.
marks
Display
of
English,
marks
Hindi,
of
individual
Marathi, HAND
BOOKSOP

subjectMaths

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy