JavaScript can change styles

 

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>



<p id="Zaki" fontsize='12px'>Hello Zaki</p>
<button type="button" onClick="document.getElementById('Zaki').style.fontSize='8px'">
Click to Redcue
</button>

</body>
</html> 

where to put codes

 

<!doctype html>
<html>
<head>
<script>
function myFunction(){
	document.getElementById('demo').innerHTML="paragraph changed.";
	
}

</script>

</head>

<body>
<h2> javascript in head</h2>
<p id="demo">A Paragraph</p>
<button type="button" onClick="myFunction()">
Try  It
</button>
</body>


<footer>

</footer>
</html>

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *