Skip to content

Instantly share code, notes, and snippets.

@httpJunkie
Created January 31, 2014 02:21
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 httpJunkie/8725568 to your computer and use it in GitHub Desktop.
Save httpJunkie/8725568 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function write (message) {
document.getElementById('message').innerHTML += message + '<br/>';
}
function calculateCircumference(diameter){
payload=(diameter * Math.PI).toFixed(3);
//corresponds with "Bay" id on div tag
document.getElementById("Bay").innerHTML=payload+" - Inches";
}
write(calculateCircumference(4).toFixed(3));
</script>
<meta name="description" content="Calculate Circumference" />
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body onLoad="calculateCircumference(4);">
<h1>Calculate Circumference</h1>
<h3>On Body onLoad</h3>
<h3>with diameter of 4 inches</h3>
<br /><br />
<div id="Bay">This will be replaced on Body onLoad by PI calculation</div>
<br /><br /><p>by.httpJunkie</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment