Java Script
JavaScript
javaScript is programming code that can be inserted into html page.
Eg:-
1)
<html>
<head>
<title>Javascript</title>
</head>
<body>
<script>
document.write("My first javascript ");
</script>
</body>
</html>
Output :-
My first javascript
2)
<button type='button' onclick="document.getElementById('demo').innerHTML='hello Java script!'">Click me </button>
{click button then print hello java}
<button type='button' onclick="document.getElementById('demo').style.fontSize='35px'">Click me </button>
{click button change fontsize}
<button type='button' onclick="document.getElementById('demo').style.color='red'">Click me </button>
{click button change fontcolor}
<button type='button' onclick="document.getElementById('demo').style.display='none'">Click me </button>
{click button remove button}
3)
< id='demo'></p>
<p id='demo1'></p>
<p id='demo2'></p>
<p id="demo3"></p>
<button onclick="document.write(5+7)">Try it</button>
<script>
document.getElementById("demo").innerHTML=5+6;
document.getElementById("demo1").innerHTML="5+6";
document.getElementById("demo2").innerHTML="5"+"6";
document.write(4+10);
window.alert(3+1);
console.log(8+3);
var x,y,z;
x=15;
y=6;
z=x+y;
document.getElementById("demo3").innerHTML=z;
</script>
Comments