Wednesday, 3 April 2019

Java Script Programs

bulb on off:
----------------------------------------------
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<img id="imgs" src="off.png"><br>
<button onclick="document.getElementById('imgs').src='on.png'">Switch On
</button>
<button onclick="document.getElementById('imgs').src='off.png'">Switch off

</button>

</body>
</html>

______________________________________________________________________

TextBlast disappear :

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p2">WELCOME To AVANTHI CSE</p>
<button onclick="document.getElementById('p2').style.display='none'">Blast</button>


</body>
</html>
_________________________________________________________________________


Current Date:

<!DOCTYPE html><html>
<head>
<title></title>
</head>
<body>
<p id="p2">Date is</p>
<button onclick="document.getElementById('p2').innerHTML=Date()">Date</button>

</body>
</html>

_____________________________________________________________________________

buttons onlick :

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p1">This is UK Language</p>
<button onclick="document.getElementById('p1').innerHTML='This is Australia Language'">Australia</button>
<button onclick="document.getElementById('p1').innerHTML='This is China Language'">China</button>
<button onclick="document.getElementById('p1').innerHTML='This is Japan Language'">Japan</button>
<button onclick="document.getElementById('p1').innerHTML='This is Canada Language'">Canada</button>


</body>
</html>

____________________________________________________________________________

change Font:


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p2">Mohandas Karamchand Gandhi, who was also known as Mahatma, "Great Soul" Gandhi, was a hero, as well as a political and spiritual leader of India. He was of the Hindu faith, of which I am too. Mohandas brought India to independence by using non-violent resistance. He thought that there was injustice being served to the Indians, especially to the immigrants by the South Africans. Gandhi was born on October 2, 1869 in Porbandar, Kathiawar, now known as Gujarat. Gandhi passed away at the age of 78 on January 30, 1948. Mahatma Gandhi was brought up in India near Rajkot, where he did most of his studies. In 1888, Gandhi went to London, leaving his wife and son behind, to pursue his degree in law. Later in 1893, Gandhi went to South Africa to work and found that there was a lot of prejudice towards Indians. That was the reason Gandhi began protesting and eventually he became an inspiring hero for millions. The three main qualities that define Gandhi as a hero are his strong leadership, simplicity and bravery.</p>
<button onclick="document.getElementById('p2').style.fontFamily='Ravie'">
change me
</button>

</body>
</html>

________________________________________________________________________________

change Size:


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p3">It’s our unshakeable belief that India will never achieve its true growth story until the rural sector of the country is empowered to make choices and transform their own lives. With this thought, we initiated SHARE (Society to Heal Aid Restore Educate) in 1983. In 2013, SHARE metamorphosed into the Swades Foundation with a mission to empower rural lives through a unique 360-degree development model which covers four key thematic areas namely Health & Nutrition, Education, Water & Sanitation and Economic Development. Our aim is to ensure that this model can be replicated at scale across India and perhaps even the world.
</p>
<button onclick="document.getElementById('p3').style.fontSize='32px'">change Size</button>

</body>
</html>

_________________________________________________________________________________

variable declaration:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
var a=10;
document.writeln(a);


</script>

</body>
</html>

_________________________________________________________________________________

variable add:



<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p1"></p>
<script type="text/javascript">
var a=10;
var b=20;
var c;
c=a+b;
document.getElementById('p1').innerHTML=c;

</script>

</body>

</html>

________________________________________________________________________________

undefine:


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p5"></p>
<script type="text/javascript">
var a;
document.getElementById('p5').innerHTML=a;
</script>
</body>
</html>
________________________________________________________________________________

stringadd:


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p2"></p>
<script type="text/javascript">
var a="vanja";
var b="manasa";
var c;
c=a+b;
document.getElementById('p2').innerHTML=c;


</script>

</body>
</html>

______________________________________________________________________________

StringVarAdd:



<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p4"></p>
<script type="text/javascript">
var a=10;
var b="manasa";
var c;
c=a+b;
document.getElementById('p4').innerHTML=c;
</script>

</body>
</html>

________________________________________________________________________________

StringVarAdd2:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p4"></p>
<script type="text/javascript">
var a=10;
var b="manasa";
var d=10;
var c;
c=b+a+d;
document.getElementById('p4').innerHTML=c;
</script>

</body>
</html>
_____________________________________________________________________________

StringVarAdd3:


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p4"></p>
<script type="text/javascript">
var a=10;
var b="manasa";
var d=10;
var c;
c=a+d+b;
document.getElementById('p4').innerHTML=c;
</script>

</body>
</html>

_____________________________________________________________________________

Array:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p2">HELLO</p>
<script type="text/javascript">
var names=["Ramesh","Suresh"];
document.getElementById('p2').innerHTML=names[0]+"<br>"+names[1];
</script>

</body>
</html>

____________________________________________________________________________

ArrayMultiLevel:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="p6"></p>
<script type="text/javascript">
var names={ Firstname : "manasa",
                    Lastname : "vanja",
                    Age : 20,
                    Education : "b.tech"
                };
   document.writeln(names.Firstname,names.Lastname,names.Age,names.Education);
</script>

</body>
</html>
_____________________________________________________________________________



No comments:

Post a Comment