Display Hello As Soon As The Page Is Loaded Using Javascript. / Program-1
Display Hello As Soon As The Page Is Loaded Using Javascript. / Program-1
*/
Program-1
<HTML><title>Prashant</title>
<BODY><SCRIPT language="JavaScript">
document. write ("<h1>JavaScript is loaded.</h1>");
document. write("<h1>Hello JavaScript</h1>");
</SCRIPT></BODY></HTML>
Output-1
Output-2
Output-3
/* Accept the values from the user i.e. accept name,age,roll no. and
marks and display them along with total marks.*/
Program-4
<HTML><HEAD><title>Prashant</title><SCRIPT>
function result ()
{
a=parseInt (frm.english.value);
b=parseInt (frm.hindi.value);
c=parseInt (frm.math.value);
d=parseInt (frm.science.value);
n=frm.nm.value;
g=frm.ag.value;
r=frm.rl.value;
t= (a+b+c+d);
pr= ((a+b+c+d)/4);
if (pr>80 && pr<=100)
gr='A';
else if (pr>60 && pr<=80)
gr='B';
else if (pr>40 && pr<=60)
gr='C';
else
gr="Fail";
document.write("<H1> align=center>Personal Marksheet</H1>");
document.write("<FORM method=post name=fr>");
document.write("<BR><B>Name :</B><INPUT type=text name=nm>");
document.write("<B>Age :</B><INPUT type=text name=ag>");
document.write("<B>Roll No. :< /B><INPUT type=text name=rl>");
document.write("<BR><BR><H3>Marks Details</H3><BR>");
document.write("<B>English :</B><INPUT type=text name=english><BR>");
document.write("<B>Hindi :</B><INPUT type=text name=hindi><BR>");
document.write("<B>Maths :</B><INPUT type=text name=math><BR>");
document.write("<B>Science :</B><INPUT type=text
name=science><BR><BR><BR>");
document.write("<B>Total :</B><INPUT type=text name=ttl>");
document.write("<B>Percentage :</B><INPUT type=text name=per>");
document.write("<B>Grade :</B><INPUT type=text name=grd><BR><BR>");
fr.english.value=a;
fr.hindi.value=b;
fr.math.value=c;
fr.science.value=d;
fr.ttl.value=t;
fr.per.value=pr;
fr.grd.value=gr;
fr.nm.value=n;
fr.ag.value=g;
fr.rl.value=r;
document.write("</FORM>");
} </SCRIPT></HEAD><BODY><H1><u>Personal Marksheet</u>
<FORM method=post name=frm><B>Name :< /B>
<INPUT type=text name=nm value=""><B>Age :< /B>
<INPUT type=text name=ag value=""><B>Roll No. :< /B>
<INPUT type=text name=rl value=""><BR><BR>
<H1><u>Marks Details</u></H1><BR><B>English :< /B>
<INPUT type=text name=english><BR><B>Hindi :< /B>
<INPUT type=text name=hindi><BR><B>Math :< /B>
<INPUT type=text name=math><BR><B>Science :< /B>
<INPUT type=text name=science><BR><BR><BR></H1>
<INPUT type=button value=RESULT onclick=result ()>
</FORM></BODY> </HTML>
Output-4
/* Try to accept the color from the user and on click of bgcolor button,
it should change the bgcolor.*/
Program-5
<HTML><HEAD><title>Prashant</title><SCRIPT>
function bg()
{
document.bgColor=frm.color.value;
}
</SCRIPT></HEAD><BODY>
<B><h1><font color="white">Developed by Prashant Yadav.</font></h1></B>
<FORM name=frm><B><h1><font color="white">Background Color
:</font></B><INPUT type=text value="" name="color"></h1>
<INPUT type=button value="Change back ground color" onClick=bg()>
</BODY></HTML>
Output-5
Output-6
Output-7
/* Try to make checkboxes and then display which checkbox user has
selected.*/
Program-8
<HTML><HEAD><title>Prashant</title><SCRIPT language="javascript">
function box()
{
txt="User's hobbies are :";
for(i=0;i<cb.length;i++)
{if(cb[i].checked==1){
txt+=cb[i].value+" ";
}}choice.value=txt;
}</SCRIPT></HEAD><BODY><H1>Please tick your hobbies<BR>
<INPUT type="checkbox" name="cb" value="Reading"><B>Reading</B>
<INPUT type="checkbox" name="cb" value="Eating"><B>Eating</B>
<INPUT type="checkbox" name="cb" value="Sleeping"><B>Sleeping</B>
<INPUT type="checkbox" name="cb" value="Dancing"><B>Dancing</B>
<INPUT type="checkbox" name="cb" value="Singing"><B>Singing</B>
<INPUT type="checkbox" name="cb" value="Playing"><B>Playing</B></H1>
<BR><BR><INPUT type="button" value="Submit" onclick="box ()"><BR><BR>
<INPUT type="text" name="choice" size="90"></BODY></HTML>
Output-8
Output-9
Output-10
/* Try to accept two numbers and tell which is maximum out of the
two.*/
Program-11
<HTML><HEAD><TITLE>Prashant</TITLE><SCRIPT language="JavaScript">
function max () {
a=parseFloat (nm1.value);
b=parseFloat (nm2.value);
if (a>b)
{
alert ("Maximum of" + a + "and" + b +" is: + a);
}
else
{
alert ("Maximum of" + a + "and" + b +" is: + b);
}} </SCRIPT></HEAD><BODY>
<B><H1>Enter the two numbers from which maximum is to be told</H1></B>
<BR><BR><B><H1>Number 1 :< /B><INPUT type=text name=nm1 ></H1><BR>
<B><H1>Number 2 :< /B><INPUT type=text name=nm2 ></H1><BR>
<INPUT type=button value="SUBMIT" onclick=max ()>
</BODY></HTML>
Output-11
Output-12
Output-13
Program-14
<HTML><BODY><H3 align=center>Amazing Beauty</H3>
<IMG src="xanimal12_1024.jpg" usemap="#my" height=786 width=1024>
<MAP name="my">
<area shape="rect" coords="25, 71,304,533" href="image1.htm">
<area shape="rect" coords="684,411,848,541" href="image2.htm">
<area shape="rect" coords="550, 247, 1004, 471" href="image3.htm">
</MAP></BODY></HTML>
Image-1.html
<HTML><BODY><H2 align=center>Fisher Men ON DUTY</H2>
<TABLE><TR><TD><IMG src="birds4.jpg"></TD>
<TD valign="top"><B> These are the daring
fishermen who dare to reach<BR>
the lap of the water goddess.</b></TD>
</TR></TABLE></BODY></HTML>
Output-14
Output-15
Output-16
Output-17
Output-18
Output-19
Output-20
Output-21