Just Copy Paste and save in HTML Format

 Program 1:

<!DOCTYPE HTML>
<html><head>
<script language =javascript>
var f1,f2;
f1=prompt("Enter First Value",0);
f2=prompt("Enter 2nd Value",0);
n1=parseInt(f1);
n2=parseInt(f2);
sum=n1+n2;
alert("Sum of two numbers is "+sum);
</script></head><body>Refresh page to start program</body></html>
Program 2:
<!DOCTYPE HTML>
<html><head>
<title>Sum of Even Numbers</title>
<script type="text/javascript">
var sum=0,n;
for(n=2;n<=100;n+=2)
sum=n+sum;
document.write("Sum of Even Numbers is "+sum+"<br");
</script></head><body></body></html>


Program 3:
<!DOCTYPE HTML>
<html><head>
<title>Heading AUTO Create</title>
  <script type="text/javascript">
for(var i=1;i<=6;i++)
  { document.writeln("<H"+i+">"+"Heading"+i);
}
  </script></head><body></body></html>

Program  4:
<!DOCTYPE HTML>
<html><head>
<title>Break Statment</title>
<script type="text/javascript">
for(var i=0;i<=10;i++)
{
if(i==6)
break;
document.writeln(i+"<br>");
} document.write("Broke on 6") ;
  </script></head><body></body></html>

Program 5:
 <!DOCTYPE HTML>
<html><head>
<title>Continue Statement</title>
<script type="text/javascript">
for(var i=0;i<=10;i++)
{
if(i==5)
continue;
document.write(i+"<br>");
}
document.write("Skip on 5") ;
</script></head><body></body></html>

Program 6:


<!DOCTYPE html>
<html>
<body>
<a name="html">HTML Tutorial</a><br>
<a name="css">Style Sheets Tutorial</a><br>
<a name="java">JAVA Tutorial</a><br>
<a href="js">JavaScript Tutorial</a>
<p>Number of Links:
<script>
document.write(document.anchors.length);
</script></p>
</body>
</html>
Output:Number of Links: 3

Program 7:


<!DOCTYPE html>
<html>
<body>

<img border="0" src="name of image" width="150" height="120">
<img border="0" src="name of image" width="150" height="120">

<p>Number of images:
<script>
document.write(document.images.length);
</script></p>

</body>
</html>

Output: Number of images: 2
Program 8:
<!DOCTYPE HTML>

<html>

<head>
  <title>Untitled</title>
 <script type="text/javascript">
 function full()

 {    var e,m,s,b,p,c,u,comp;
     e=frm.e.value;
     m =frm.m.value;
     s=frm.s.value;
     b =frm.b.value;
     p=frm.p.value;
     c =frm.c.value;
     u=frm.u.value;
     comp =frm.comp.value;
    var c=parseInt(e)+parseInt(m)+parseInt(s)+parseInt(b)+parseInt(p)+parseInt(c)+parseInt(u)+parseInt(comp);
     frm.f.value=c;

 }
</script>
  </head>

<body>
    MarkSheet
  <form action=""name ="frm">
<table style="width: 0px">
  <tr>
    <td>English</td>
    <td><input value=0 type="text" name="e"onChange="full()";></td>
  </tr>
  <tr>
    <td>Math</td>
    <td><input type  =text value=0 name="m" onChange="full()";></td>
  </tr>
  <tr>
    <td>Science</td>
    <td>  <input value=0 type="text" name="s"onChange="full()";></td>
  </tr>
  <tr>
    <td>Biology</td>
    <td>     <input type  =text value=0 name="b" onChange="full()";></td>
  </tr>
  <tr>
    <td>Physics</td>
    <td> <input value=0 type="text" name="p"onChange="full()";></td>
  </tr>
  <tr>
    <td>Chemistry</td>
    <td><input type  =text value=0 name="c" onChange="full()";></td>
  </tr>
  <tr>
    <td>Urdu</td>
    <td><input value=0 type="text" name="u"onChange="full()";></td>
  </tr>
  <tr>
    <td>Computer</td>
    <td> <input type  =text value=0 name="comp" onChange="full()";></td>
  </tr>
  <tr>
    <td> Obtained</td>
    <td>   <input type=text name=f value=0 > </td>
  </tr>
  <tr>
    <td>Result</td>
    <td>      <input type="text" / value="Result" onFocus="res()";> </td>
  </tr>
</table>     </form>
</body>

</html>

Program 9:
<!DOCTYPE HTML>

<html>

<head>
<style>

td
{
color:red;
width:25px;
background: white;
}
td.tab
{
color:red;
width:25px;
background: green;
}
td.start
{
color:green;
width:25px;
background: blue;
}
td.end
{
color:blue;
width:25px;
background: black;
}        </style>
<script type="text/javascript">
var i;
var tab=parseInt(prompt("Enter Table value You want",0));
var start=parseInt(prompt("Enter Table Start value You want",0));
var end=parseInt(prompt("Enter Table Ending value You want",0));
              document.write("Table of "+tab+"to "+end);
for(i=start;i<=end;i++)
document.write("<table border= 1px><tr><td class=tab>"+tab+"</td><td>X</td><td class=start >"+i+"</td><td>=<td class=end>"+tab*i+"</td> </tr></table>")  ;
</script>
<title>For Loop</title>

</head>

<body>

</body>

</html>