A Pen by Steven Reginald Barkley on CodePen.
Created
November 7, 2022 13:55
-
-
Save steven-barkley/45b8ca90d47b4b31b6297afe70028219 to your computer and use it in GitHub Desktop.
Practice | Javascript 2
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
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Functions</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<h2>My First JavaScript</h2> | |
<button type="button" onclick="document.getElementById('demo').innerHTML = Date()"> | |
Display the time and date. | |
</button> | |
<p id="demo"></p> | |
<h3>Changing the display in JavaScript</h3> | |
<button type="button" onclick="document.getElementById('test').innerHTML= 'Cool, JavaScript is dynamic!'"> | |
Change text | |
</button> | |
<p id="test">JavaScript controls behavior on webpages!</p> | |
<h3>Turn the lightbulb off and on.</h3> | |
<button type="button" onclick="document.getElementById('lighttoggle').src='https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftoppng.com%2Fpublic%2Fuploads%2Fpreview%2Flight-bulb-on-off-png-11553940208oq66nq8jew.png&f=1&nofb=1'"> | |
OFF | |
</button> | |
<img id="lighttoggle" src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftoppng.com%2Fpublic%2Fuploads%2Fpreview%2Flight-bulb-on-off-png-11553940208oq66nq8jew.png&f=1&nofb=1" style="width:250px; height:300px"> | |
<button type="button" onclick="document.getElementById('lighttoggle').src='https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftoppng.com%2Fpublic%2Fuploads%2Fpreview%2Flight-bulb-on-off-png-11553940194wdc9uy3j5o.png&f=1&nofb=1'"> | |
ON | |
</button> | |
<h3>More fun with JavaScript</h3> | |
<button type="button" onclick="document.getElementById('enlarged').style.fontSize='65px'"> | |
Bigger text | |
</button><br> | |
The follow text will be enlarged. | |
<p id=enlarged>Small to Big</p> | |
<button type="button" onclick="document.getElementById('invisible').style.display='none'"> | |
Vanishing text | |
</button> | |
<p id="invisible">Now you see me.....</p> | |
<script src="function.js"></script> | |
<script> | |
document.write("<h4>Creating html header displays within Javascript."); | |
</script> | |
<script> | |
document.write(player); | |
</script> | |
</body> |
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
function welcome() { | |
alert( "I am learning Javascript. Please follow me on Codepen.io" ); | |
} | |
welcome() | |
var player = 'Steven Reginald Barkley'; |
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
body { | |
align-items: center; | |
justify-content: center; | |
text-align: center; | |
justify-items: center; | |
background-color: #9acd32; | |
font-size: 40px; | |
} | |
/* Turn background color to white on button click | |
background-color: white |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment