Skip to content

Instantly share code, notes, and snippets.

@nlively
Created June 14, 2013 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nlively/5784844 to your computer and use it in GitHub Desktop.
Save nlively/5784844 to your computer and use it in GitHub Desktop.
<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