Created
December 4, 2015 17:24
-
-
Save anonymous/986998b5867acc6d2a61 to your computer and use it in GitHub Desktop.
JS Bin JavaScript Refresher // source http://jsbin.com/nogidalaxe
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> | |
<meta name="description" content="JavaScript Refresher"> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
p { | |
color: red; | |
} | |
</style> | |
</head> | |
<body> | |
<p id='paragraphText'> This is cool </p> | |
<input type='text' id='changeUserText'> | |
<button onClick='changeTheText()'> Change the text </button> | |
<p id='paragraphText'> This is cool </p> | |
<script id="jsbin-javascript"> | |
var variableNumber = 2; | |
var secondNumber = 2; | |
var variableName = 'Jason'; | |
function changeTheText(){ | |
work(); | |
} | |
function work() | |
{ | |
var changeTextVariable = ''; | |
document.getElementById('paragraphText').style.color = 'orange'; | |
if (variableName == 'Jason') | |
{ | |
// Change paragraph text | |
changeTextVariable = document.getElementById('changeUserText').value; | |
document.getElementById('paragraphText').innerHTML = changeTextVariable ; | |
} | |
else if (variableName == 'Jason Derulo') | |
{ | |
alert("I'm a pop star"); | |
} | |
else | |
{ | |
changeTextVariable = 'Else Statement fired!'; | |
document.getElementById('paragraphText').innerHTML = changeTextVariable; | |
} | |
document.getElementById('changeUserText').value = ''; | |
} | |
</script> | |
<script id="jsbin-source-css" type="text/css">p { | |
color: red; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var variableNumber = 2; | |
var secondNumber = 2; | |
var variableName = 'Jason'; | |
function changeTheText(){ | |
work(); | |
} | |
function work() | |
{ | |
var changeTextVariable = ''; | |
document.getElementById('paragraphText').style.color = 'orange'; | |
if (variableName == 'Jason') | |
{ | |
// Change paragraph text | |
changeTextVariable = document.getElementById('changeUserText').value; | |
document.getElementById('paragraphText').innerHTML = changeTextVariable ; | |
} | |
else if (variableName == 'Jason Derulo') | |
{ | |
alert("I'm a pop star"); | |
} | |
else | |
{ | |
changeTextVariable = 'Else Statement fired!'; | |
document.getElementById('paragraphText').innerHTML = changeTextVariable; | |
} | |
document.getElementById('changeUserText').value = ''; | |
} | |
</script></body> | |
</html> |
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
p { | |
color: red; | |
} |
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
var variableNumber = 2; | |
var secondNumber = 2; | |
var variableName = 'Jason'; | |
function changeTheText(){ | |
work(); | |
} | |
function work() | |
{ | |
var changeTextVariable = ''; | |
document.getElementById('paragraphText').style.color = 'orange'; | |
if (variableName == 'Jason') | |
{ | |
// Change paragraph text | |
changeTextVariable = document.getElementById('changeUserText').value; | |
document.getElementById('paragraphText').innerHTML = changeTextVariable ; | |
} | |
else if (variableName == 'Jason Derulo') | |
{ | |
alert("I'm a pop star"); | |
} | |
else | |
{ | |
changeTextVariable = 'Else Statement fired!'; | |
document.getElementById('paragraphText').innerHTML = changeTextVariable; | |
} | |
document.getElementById('changeUserText').value = ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment