Search
Sponsors

Posts Tagged ‘calculator’

Area Calculator

Wednesday, September 30th, 2009

<!– Paste this into the HEAD of your HTML document –>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!– Original: Michael Hundt (mchundt@nglic.com) –>
<!– Web Site: http://www.cinet.net/~mhundt/mystuff.htm –>

<! >
<! >

<!– Begin
function doArea(num) {
switch(num) {
case 0 : return (""); break;
case 1 : var length = prompt("Please enter the length of your square:", "");
length = length * length;
return (length); break;
case 2 : var width = prompt("Please enter the width of the base:", "");
var height = prompt("Please enter the height of the triangle:", "");
return (width * height / 2); break;
case 3 : var width = prompt("Please enter the width of your rectangle:", "");
var height = prompt("Please enter the height of your rectangle:", "");
return (width * height); break;
case 4 : var radius = prompt("Please enter the radius of the circle: ", "");
return (Math.PI * Math.pow(radius, 2)); break;
case 5 : var radius = prompt("Please enter the radious of the sphere:", 0);
return (4 * Math.PI * (Math.pow(radius, 2))); break;
}
}
// End –>
</script>
</HEAD>

<!– Copy this into the BODY of your HTML document –>

<center>
<form name=calcarea>
Find the area of a
<select name="shape" size="1" onChange="this.form.area.value = doArea(this.selectedIndex);">
<option> …
<option value="square">Square
<option value="triangle">Triangle
<option value="rectangle">Rectangle
<option value="circle">Circle
<option value="sphere">Sphere
</select>
= <input type=text name=area size=10>
</form>
</center>

Temperature Conversion

Thursday, September 24th, 2009
   1:  <!-- STEP ONE: Copy this code into the BODY of your HTML document -->
   2:   
   3:  Enter a number in either field, then click outside the text box.
   4:   
   5:  <form>
   6:  F: 
   7:  <input type="text" name="F" value="32" 
   8:  onChange="C.value = 100/(212-32) * (this.value - 32 )"><br>
   9:  C: 
  10:  <input type="text" name="C" value="0" 
  11:  onChange="F.value = (212-32)/100 * this.value + 32 "><br>
  12:  </form>

Ad Banners calculator

Friday, January 9th, 2009

 

<script LANGUAGE=”JavaScript”>

<!– Begin

function adCalc(form) {

var ok = 0;

var cost = form.cost.value;

var cpm = form.cpm.value;

var exposures = form.exposures.value;

var complete = “It looks like you entered all the information already! With this calculator, you just enter two of the fields and it solves for the last one.”;

var incomplete = “Oops! It doesn’t appear you entered enough information. Please enter at least two entries in order to solve for the other two.”;

if (cost != “” && cpm != “”) { form.exposures.value = ((cost / cpm) * 1000); ok++; } // solve for exposures

if (cost != “” && exposures != “”) { form.cpm.value = ((1000 / exposures) * cost); ok++; } // solve for cpm

if (cpm != “” && exposures != “”) { form.cost.value = cpm / (1000 / exposures); ok++; } // solve for cost

if (!ok) alert(incomplete); // they did not enter at least 2 fields

if (cost != “” && cpm != “” && exposures != “”) alert(complete); // they filled in all the fields!

}

// End –>

</script>

<center>

<form method=”post”>

<table border=”1″ cellpadding=”5″>

<tr>

<td align=”center”>Cost:</td>

<td align=”center”><input type=”text” name=”cost” size=”8″ value onFocus=”select()”></td>

</tr>

<tr>

<td align=”center”>CPM:</td>

<td align=”center”><input type=”text” name=”cpm” size=”8″ value onFocus=”select()”></td>

</tr>

<tr>

<td align=”center”>Exposures:</td>

<td align=”center”><input type=”text” name=”exposures” size=”8″ value onFocus=”select()”></td>

</tr>

<tr>

<td colspan=”2″ align=”center”><input type=”button” value=”Solve” onClick=”adCalc(this.form)”>

<input type=”reset” value=”reset”></td>

</tr>

</table>

</form>

</center>

Translate