Wednesday 10 May 2017

js statement

<html>
<head>
<script>
function myFunction1()
{ var a=10;
var b=20;
var c=a+b;
document.getElementById("para2").innerHTML=c;
}

function myFunction2()
{
document.getElementById("para3").innerHTML="this is for para 3 after change belong to same function";
document.getElementById("para4").innerHTML="this is for para 4 after change belong to same function";

}


</script>
</head>
<body>
<p id='para1'>this is the para 1 b4 change</p>
<button type='button' onClick="document.getElementById('para1').innerHTML='para 1 after change'"> para 1 </button>


<p id='para2'>this is the para 2 b4 change</p>
<button type='button' onClick='myFunction1()'> para 2 </button>


<p id='para3'>this is the para 3 b4 change</p>
<button type='button' onClick="myFunction2()"> para 3 </button>


<p id='para4'>this is the para 4 b4 change</p>
<button type='button' onClick="myFunction2()"> para 4</button>


</body>
</html>

No comments:

Post a Comment