Created
June 14, 2013 20:04
-
-
Save nlively/5784844 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<html> | |
<body> | |
<a href="javascript:switchDeveloper()">Switch developer</a> | |
<div id="dev-name"></div> | |
<script> | |
var developers = [ | |
'Nathan', | |
'Noah', | |
'Joel', | |
'Connor', | |
'Brian' | |
]; | |
var currentDev = 0; | |
function getCurrentDeveloper() { | |
return developers[currentDev]; | |
} | |
function updateDeveloperDisplay() { | |
var el = document.getElementById('dev-name'); | |
el.innerHTML = getCurrentDeveloper() ; | |
} | |
function switchDeveloper() { | |
currentDev++; | |
if (currentDev >= developers.length) { | |
currentDev = 0; | |
} | |
updateDeveloperDisplay(); | |
} | |
updateDeveloperDisplay(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment