Skip to content

Instantly share code, notes, and snippets.

@dustinlarimer
Last active December 26, 2015 11:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustinlarimer/7145612 to your computer and use it in GitHub Desktop.
Save dustinlarimer/7145612 to your computer and use it in GitHub Desktop.
Intro to JS kickoff session
<!DOCTYPE html>
<html>
<head>
<title>Intro to JavaScript!</title>
<style>
body {
background: #fbfbfb;
}
.container {
margin: 100px auto 0;
text-align: center;
width: 700px;
}
#total {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 72px;
padding: 10px;
text-align: center;
}
#btn {
background: #808080;
border: medium none;
border-radius: 5px;
color: #fff;
cursor: pointer;
font-size: 18px;
padding: 15px 30px;
}
</style>
<script>
window.onload = function() {
var total_elem = document.getElementById('total');
var btn_elem = document.getElementById('btn');
var a = 1;
var b = 2;
var c = a * b
total_elem.innerHTML = c
btn_elem.onclick = function() {
c = c * 3;
total_elem.innerHTML = c
}
/*
setInterval(function() {
c = c * 2;
total_elem.innerHTML = c
}, 1000);*/
/*
update_total = function(value) {
total_elem.innerHTML = value
}
update_total(c);*/
};
</script>
</head>
<body>
<div class="container">
<div id="total"></div>
<button id="btn">Add one!</button>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment