1 / 3
amogtech
2 / 3
mhk
3 / 3
ccg


Eg1.

<html>
<head>
<title>TNW (web Service & ICT Solutions)</title>
</head>
<body>
<script>
function funSum(num1, num2){
return num1 + num2;
}
document.getElementById("demo").innerHTML = funSum(5,5);
</script>
</body>
</html>

 

Eg2.

<html>
<head>
<title>TNW (Web Service & ICT Solutions)</title>
</head>
<body>
<p id = "demo"></p>
<button type = "button" onclick = "myFun()">Check Date</button>
<script>
function myFun(){
document.getElementById("demo").innerHTML = Date();
}
</script>
</body>
</html>

 

Eg3.

<html>
<head>
<title>TNW (Web Service & ICT Solutions)</title>
</head>
<body>
<button type = "button" onclick = "myFun()">Count The Words</button>
<p id = "demo"></p>
<script>
function myFun(){
var y = "I love you more than I can say";
var x = y.length;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>


Share On:

What do you think?

Send us feedback!