View Single Post
  #2 (permalink)  
Old 03-10-2007, 06:55 AM
killerkev06 killerkev06 is offline
Persona Non Grata
 
Join Date: Mar 2007
Posts: 124
iTrader: (0)
killerkev06 is on a distinguished road
Default

Maybe something like this will help you get started:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
 "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
<head> 
 <meta http-equiv="Content-Type" content="text/html; charset:utf-8"> 
 <title></title> 
 <script type="text/javascript"> 
function calculate() { 
 var L = document.getElementById('L'); 
 // You should add a check here to make sure the value is numeric 
 var str = ""; 
 str += "#1 " + L.value + " * 2.05 = " + (L.value * 2.05); 
 str += "\n#2 " + L.value + " * 1.99 = " + (L.value * 1.99); 
 str += "\n#3 " + L.value + " * 1.62 = " + (L.value * 1.62); 
 str += "\n#4 " + L.value + " * 0.95 = " + (L.value * 0.95); 
 alert(str); 
} 
function init() { 
 // Attach behaviors 
 var calc = document.getElementById('calc'); 
 calc.onclick = calculate; 
} 
window.onload = init; 
 </script> 
</head> 
<body> 
<form action=""> 
 <div> 
 <input type="text" id="L"> 
 <input type="button" id="calc" value="Calculate"> 
 </div> 
</form> 
</body> 
</html>
Reply With Quote
Sponsored Links
Register and sign in to hide this ad block