argest Notepad
Edie Format View
File Help
khtml>
<head>
title> javascript program to find largest among three numbers</title>
/head
body>
<Script type="text/javascript">
var
a=parseInt (prompt( "Enter first number"));
var
b=parseInt (prompt ( "Enter second number"));
var
c=parseInt (prompt("Enter third number"));
var max=(a>b &&
a>c)?a : ((b>c)?b: c);
[Link]("<br/> Largest number is ="+max);
/script>
2factorial- Notepad
Edit Format View Help
Fie
khtml>
head
title>Program to find the factorial of a number</title>
/head>
body
script type="text/javascript">
var i,facto;
var num=parseInt (prompt( "Enter a number"))
i-1;
facto=1;
while (i<=num)
facto-i;
it1;
[Link]("Factorial of "+ num +" is ="+facto);
/script
</body>
</html>
3pime-Notepad
Edt Format View
File Help
khtml>
<head
title program to check whether the number is prime or not</title>
</head>
<body
script type="text/javascript">
var
numparseInt (prompt("Enter a number"));
var temp=num;
var i=2
if (num=2)
[Link]("(<br/> "+ num +" is a prime number")
while(ic=parseInt (num/2))
if(numi=0)
break;
i+1;
if (i=parseInt (num/2))
[Link]("<br/> "+ num +" is a prime number");
else
[Link]("<br/> "+ num +" is not a prime number");
/script
/body>
Aarmstrong - Notepad
File Edit Format View Help
<html
chead
<title> Program to check whether the number is armstrong number or not</title>
/head
body>
script type="text/javascript">
var
num=parseInt(prompt ("Enter a number "));
var rem;
var temps
var res=6
temp=num;
while(temp>0)
rem=temp%10;
res+=rem*rem*rem;
temp parseInt (temp/10) ;|
if(res==num)
[Link]("<br/>"+ num +" is an armstrong number") ;
else
[Link]("<br/>"+ num +" is not an armstrong number ");
/script
/body
/html>
Sdigit- Notepad
Edit Fomat View Help
File
khtml
<head>
title Program to write its digits in words </title>
/head
body
Script type="text/javascript">
var num=parseInt (prompt("Enter a number "))
var rem, rev, temP
temp=num;
reve
while(temp>0)
rem=temp%10;
revarev*16+rem;
temp parseInt (temp/10)
[Link]("<br/> "*+ num + " in words =")
while(rev>e)
rem=rev%10;
rev=parseInt (rev/10);
switch(rem)
case :[Link]( "zero ");
break;
case 1:document. write( "one ");
break
case 2: [Link]( "two ");
break;
case
brea
3:[Link]("three ");
case
4:[Link]("four ");
break
case 5:[Link]( "five ");
break;
case 6:document.
write("six ");
beak;
case
7:[Link]("seven ");
break;
case write( "eight ");
8:document.
break;
case
9:[Link]("nine ");
break
default:[Link]("It is not a number");
</script>
/body
</html>
6mathobj-Notepad
Ed Fommat View Help
File
khtml>
head
<title Program to demonsrate Math objects</title
</head
<body>
<seript type="text/javascript">
var vall=Math. LN2;
document. write ( "<br/> Property value of LN2 is="+val1) ;
vall=Math. LN10;
[Link]("<br/>Property value of LN1e is="+val1);
val1=Math. PI;
[Link]("<br/>Property value of PI is="+val1);
vali=Math . sQRT1_2
[Link]("<br/>Property value of sQRT12 is ="+val1);
val1=Math.sQRT2;
document. write("<br/>Property value of SQRT2 is ="+val1);
</script>
</body>
</htm1>
factofun- Notepad
File Edit Fomat Vew Help
<html
chead
title> Program to find factorial of number using function</title>
script type"text/javascript">
function facto(num)
var i,fact;
fact=1
for (i=2;ic=num; i++)
{
fact*=i;
return fact;
</script
</head>
body
Script type="text/javascript">
var
n=parseInt (prompt("Enter
[Link]( "Factorial of
a nummber "));
"+ n +" is ="+facto (n) ) ;
/script>
</body
</html>
8obo-Notepad
File Edie Format View Help
<html
<head
title Program to generate fibonacci series</titles
/head
body>
seript type="text/javascript"
var i,a,b, sum, n;
n=parseInt (prompt ("input 1ength of the series ") );
ao;
b 1;
Series is =");
document. write( "Fibonacci
for(i-0;icn;it+)
if(i-1)
[Link](" "+i);
else
1
sum=a+b;
a=b
b-sum
[Link](" "+sum)
script»
</body>
/html>
Slargestfun - Notepad
Edit Fomat View Help
File
khtml>
head
title Program to find the largest number in the array using function</title
seript type="text/javascript"
function largest)
var i,max;
var arr=new
Array (n);
[Link]("input "+ n *" array
elements ")
for(i=0; icngi++))
arr[i]=parseInt (prompt("Enter element"));
Array elememts are=");
[Link]("cbr/>
for(i-0;i<n;i++)
[Link](" "*arr[i]);
max=arrlels
for (i=e;icarr. length; i++)
if(arr[i]>max)
{
max=arr[i];
return max;
/script
/head
body>
<script
var i,n;
type="text/javascript">
n=parseInt (prompt ("Enter length of the array"));
[Link]("<br/> The largest element is ="+largest ( ));
</script>
</body
</html>
0sting-Notepad View
File dt omat Help
<html>
<head
title Program to demonstrate String properties and methods </title>
/head
body
script type="text/javascript">
var sl= "abcdef";
var s2 "ghij";
var s35
[Link]("<br/> Length of the string is ="+[Link]);
[Link]("<br/>char at 3 is ="+$[Link] (2));
$3=[Link] (s2);
[Link]("(br/> concatnated strings is ="+s3);
document. "<br/>index of de is ="+[Link]( "de")
write( )
[Link]("<br/> last index of f is ="+[Link]("f"));
[Link]( " <br/> after performing toLowerCase operation on string ="+[Link]());
[Link]("<br/> after performing toUpperCase operation on string ="+[Link]( ));
[Link]("<br/> slicing the string ="+[Link] (2,4));
[Link]("<br/> trimming the string "+[Link]());
[Link]("<br/> performing substr operation in string ="+s1. substr(1,2));
[Link]("<br/> performing replace operation in string ="+[Link]( "f", "F"));
/script>
</body>
levents-Noteped
Edt Format View Help
File
<html>
<head
t i t l e Program to demonstrate events in javascript</title>
script type ="text/javascript"
function hello()
[Link]( "Hello Students");
</script>
<script type="text/javascript">
var x 65
var y 95
var z 8;
function myMoveFunction()
[Link] ElementById ("demo"). innerHTML z+=1;
function myEnterFunction (){
document .getElementBy Id ("demo2").innerHTML x*=1;
function myOverFunction() {
document.getElement8yId( "demo3") . innerHTML y+=1;
</script»
/head
<body.
p>Click the following button</p>
<form>
input type="button" onclick="hello()" value="Say hello"/>
<div onmousemove=
"myMove Function()">
ponmous emove: <br> <span id="demo " >Mouse over me!c/span></p>
</div>
<div onmouseenter="myEnterFunction() ">
ponmouseenter : <br> <span id="demo 2 " >Mouse over me!</span></p>
/div
div onmous eover= "myOverFunction () ">
<p>onmouseover: <br> <span id="demo3" >Mouse over me!</span></p>
</div
form>
</body
</html>
2history-Notepad
File Edit Format View Help
<html
<head
title>Program to demonstrate History object</title
</head
body
b>Press the back button</b>
<input type="button" value="Back" onclick="previousPage () ">
script>
function previousPage()
[Link]. back ();
/script»
/body>
/html>
12history2-Notepad
File Edit Format View Help
<html>
<head>
title>Program to demonsatrate history object in javascript</titles
</head>
<body>
<b>Pres the forward button</b>
a href "[Link]" >Visit next page</a>
input type="button" value="Forward" onclick="NextPage() ">
Script
function NextPage() {
[Link]. forward ()
/script
</body
</html>