-
-
Save criscokid/70033 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<title>My Calc</title> | |
<META name="Author" content="Phil"> | |
</head> | |
<script type="text/javascript" src="calc_nums_only.js"></script> | |
<script type="text/javascript"> | |
function processForm() { | |
var var1= document.myform.num1.value; | |
//alert (var1); //test for the value the user types in | |
var thisOperation = document.myform.thisOperator.value; | |
//alert (thisOperation); | |
if(thisOperation == "em") | |
{ | |
var result = var1 * 0.0625; | |
var myMessage = result + ' em'; | |
} | |
if(thisOperation == "px") | |
{ | |
var result = var1 / 0.0625; | |
var myMessage = result + ' px'; | |
} | |
document.myform.results.value = myMessage; | |
} | |
/***********/ | |
</script> | |
<body> | |
<h2>My Whatever Converter</h2> | |
<form action="javascript:processForm()" method="post" name="myform"> | |
<input type="text" name="num1"> | |
<select name="thisOperator"> | |
<option value="em">Convert to EMs</option> | |
<option value="px">Convert to Pi</option> | |
</select><br /> | |
<input type="submit" name="submit" value="Calculate"><br /> | |
<input type="text" name="results" style="width:270px;"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment