Created
February 9, 2019 23:15
-
-
Save ehzawad/7feec7cdc41b81a4b336515ac17e4b04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
// Change font color to red | |
document.querySelector('#red').onclick = function() { | |
document.querySelector('#hello').style.color = 'red' | |
} | |
// Change font color to blue | |
document.querySelector('#blue').onclick = function() { | |
document.querySelector('#hello').style.color = 'blue' | |
} | |
// Change font color to green | |
document.querySelector('#green').onclick = function() { | |
document.querySelector('#hello').style.color = 'green' | |
} | |
}) | |
</script> | |
<title>Efat</title> | |
</head> | |
<body> | |
<h1 id="hello">Hello!!</h1> | |
<button id="red">Red</button> | |
<button id="blue">blue</button> | |
<button id="green">green</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment