1.squares, Roots, Cubes, Complements Program Coding
1.squares, Roots, Cubes, Complements Program Coding
1.squares, Roots, Cubes, Complements Program Coding
}
</script>
</head>
</html>
2.CALCULATOR
PROGRAM CODING
<html>
<head>
<title>CALCULATOR</title>
<script language=JavaScript>
var istring= ;
function update(value)
{
istring+=value;
document.calc.input.value=istring;
}
</script>
</head>
<body>
<form name=calc>
<center><table border=4><tr><td>
<input type=text name=input maxlength=15 size=28><br>
<input type=button value=clear >;><br>
<input type=button value=mod ><input type=button value=* ><input type=button value=7 ><input type=button value=8 ><input type=button value=9 ><input type=button value=/ ><input type=button value=4 ><input type=button value=5 ><input type=button value=6 ><input type=button value=- ><input type=button value=1 ><input type=button value=2 ><input type=button value=3 ><input type=button value=+ ><input type=button value=0 ><input type=button value=00 ><input type=button value=. ><input type=button value== ></td></tr>
</table></center>
</form></body>
</html>
3.SORTING STRINGS
PROGRAM CODING
<html>
<head>
<title>sorting string</title>
<script language=JavaScript>
a=new Array();
n=prompt(enter array size);
for(i=0;i<n;i++)
{
a[i]prompt(enter array elements);
}
document.write(array elements are<br>);
for(i=0;i<n;i++)
{
document.write(<br>,a[i]);
}
a.sort();
document.write(<br>sorted array elements are<br>);
for(i=0;i<n;i++)
{
document.write(<br>,a[i]);
}
</script>
</head>
</html>
4.HIT COUNTER
PROGRAM CODING
<html>
<script language=JavaScript>
<!
functionnameDefined(ckie,nme)
{
var splitValues
var i
for(i=0;i<ckie.length;++i)
{
splitValues=ckie[i].split(=)
if (splitValues[0]==nme) return ture
}
return false
}
functiondelBlanks(strng)
{
var result=
var i
var chrn
for (i=0;i<strng.length;++i)
{
chrn=strng.charAt(i)
if (chrn!= ) result += chrn
}
return result
}
functiongetCookieValue(ckie,nme)
{
var splitValues
var i
for (i=0;i<strng.length;++i)
{
splitValues=ckie[i].split(=)
if(splitValues[0]==nme) return splitValues[1]
}
return
}
functioninsertCounter()
{
readCookie()
displayCounter()
}
functiondisplayCounter()
{
document.write(<H3 ALIGN=CENTER>)
document.write(Youve visited this page)
if(counter==1)document.write(the first time.)
elsedocument.write(counter+time.)
document.writeln(</H3>)
}
functionreadCookie()
{
var cookie = document.cookie
counter=0
var chkdCookie= delBlanks(cookie) //are on the client computer
var nvpair=chkdCookie.split(;)
if(nameDefined(nvpair,pageCount))
counter=parselnt(getCookieValue(nvpair,pageCount))
++counter
var futdate= new Date()
var expdate=futdate.getTime()
expdate +=3600000*24*30 //expires in 1 hour
futdate.setTime(expdate)
var newCookie=pageCount=+counter
newCookie +=;expires= + futdate.toGMTString()
window.document.cookies=newCookie
}
//
</script>
<body>
<script language=JavaScript>
<!
insertCounter()
//
</script>
</body>
</html>
5.EMAIL ID VALIDATION
PROGRAM CODING
<html>
<head>
<title>email address</title>
<body bgcolor=oofff>
<front size=18>
<center><b>e-mail address</b></center></front>
<script language=JavaScript>
function validate (from_id,email)
{
var reg=/^([A-Zs-z0-9_\-\.])+1@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address=document.froms[infrom].elements[email].value;
if (reg.test(address)==false)
{
alert(Invalid Email Address);
return false;
}
}
</script>
<form id=inform method=post
action=action.phponsubmit=JavaScript:return validate(inform,email);>
<input type=text id=email name=email/>
<input type=submit value=submit/>
</form>
</body>
</html>
}
</script>
</head>
<body ></body>
</html>
7.CHOICE LIST
PROGRAM CODING
<html>
<head>
<title>McDonals</title>
<script language=JavaScript>
var m;
function pick(F1)
{
var z= ;
for(j=0;j<3;j++)
{
for(i=0;i<F1.elements[j].length;i+++)
{
If(F1.elements[j][i].selected)
{
var y=F1.elements[j].options[i].value;
z=z+\n+y;
F1.elements[3].value=z;
}
}
}
m=z;
}
functionclr(F1)
{
F1.elements[3].value= ;
}
</script>
</head>
<body bgcolor=#00fff>
<h2><font color=blue size=20><center>Welcome to the world Famous Fast
Food center
</font><br>
<font color=red size=10>McDonalds!</center></font></h2>
<form name=F1>
<form size=+2>
Select the menu items of urchoice:</font><br><br>
<table>
<trvalign =top><td>
<font size=+1>
Major dishes:</font><br>
</select>
<br><br></td><td>
<th><font size=6>The items selected from the menu are:</font></th>
<table>
<trvalign=top><td>
<textarea name=TAI rows=10 cols=50>
</textarea><br<br></td>
<td><br>
<br><br>
<b>
<input type=button value=submit>
<input type=button value=clear ></form>
</body>
</html>
8.DIGITAL CLOCK
PROGRAM CODING
<html>
<head>
<title>DIGITAL CLOCK</title>
<script language=JavaScript>
functionnextone()
{
now=new Date();
hours=now.getHours();
mins=now.getMinutes();
sec=now.getSeconds();
if(mins<10)
time= +hours+:0+mins;
else
time= +hours+:+mins;
if(sec<10)
time+=:0+sec;
else
time+=:+sec;
document.timeform.timeclock.value=time;
setTimeout(nextone();4,100);
}
setTimeout(nextone();,100);
</script>
</head>
<body bgcolor =#00fff>
<font size=25><center>
Digital clock</font>
<form name=timeform>
<font size=8>
Current time=<input type=text name=timeclock size=10>
</font>
</form>
</body>
</html>
9.MOUSE EVENTS
PROGRAM CODING
<html>
<head>
<script language=JavaScript>
functionbigImg(x)
{
x.style.height=120px;
x.style.width=120px;
}
functionnormalImg(x)
{
x.style.height=32px;
x.style.width=32px;
}
</script>
</head>
<body>
<imgsrc=C:\User \Public \Pictures \Sample Pictures \Chrysanthemum.jpg
>width=32 height=32>
</body>
</html>
<html>
<head>
<title>vbscript</title>
</head>
<script language=vbscript>
sub result(A)
if A=1 then
window.top.two.location.href=yah.html
end if
if A=2 then
window.top.two.location.href=inf.html
end if
end sub
if A=3 then
</script>
<body BGCOLOR=#00ffff>
<formname+A>
<div align=center>
<input type=radio name=choice checked>
yahoo_http://www.yahoo.com<br>
<input type=radio name=choice >altavista_http://www.altavista.com<br>
<input type=radio name=choice >
infoseek_http://www.infoseek.com<br>
</div>
</from>
</body>
</html>
<html>
<head>
<title>yahoo</title>
</head>
<body bgcolor=#9991111>
<h1><center>yahoo page</center></h1>
</body>
</html>
<html>
<head>
<title>altavista</title>
</head>
<marquee>ALTAVISTA</marquee>
<body bgcolor=#9991111>
<h1><c>Altavista
</c></h1>
</body>
</html>
<html>
<head>
<title>infoseek</title>
</head>
<body bgcolor=#9991111>
<marquee>INFOSEEK PAGE</marquee>
<h1>infoseek page</h1>
</body>
</html>