I'm getting the "NaN" error for Box 1, as well. I see how correct it (like Box 2) but I'm not skilled enough to pull it off.
Also, about having the person enter a number with 2 digits, I found this page...
http://www.coderanch.com/t/114528/HTML-CSS-JavaScript/decimal-point-restriction
I had already tried a workaround, by asking the visitor to type $123.45 as 12345. (And I added a "/100" to my code. But, that will probably produce too many errors. If anyone knows how to incorporate the coders comments at above link, let me know.
Currently, my (unfinished) page is...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML LANG=en>
<HEAD>
<TITLE>Zeek Rewards Calculator</TITLE>
<META NAME="KEYWORDS" Content="zeek rewards calculator, zeek rewards multiplier, multiplier, calculator, zeek, profit pool">
<META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW">
<style type="text/css">
body {font-size:100%;}
h1 {font-size:2.5em;font-family:timesnewroman}
h2 {font-size:1.875em;font-family:timesnewroman}
p {font-size:1.5em;font-family:verdana}
body
{
background-color:#BDBDBD;
}
</style>
</HEAD>
<body onload="calculate();">
<blockquote>
<blockquote>
<form<BR /><font size=1><BR />
<h1>Zeek Rewards Calculator</h1>
<h2>To Monitor Your Results</h2>
<BR />
<p>Have you longed for a <em>Zeek Rewards calculator</em> to help you make sure your back office report is in line with what other people are being paid in the daily Retail Profits Pool? Look no more, here it is! Simply input your appropriate amount of VIP points into Box 1 and the results show in Box 3 instantly as you type.</p>
<p>
<input type="text" id="v1" onkeyup="calculate()" value="0"/> (BOX 1) -- Enter VIP points from yesterday for line item immediately prior to last night's run. Enter no decimal, i.e., $123.45 entered as "12345" (no quotes)<BR /><BR />
<input type="text" id="v2" onkeyup="calculate()" value=".00939740" readonly="readonly"//> (BOX 2) -- Multiplier for (today), pool (yesterday), as determined by this site's webmaster.<BR /><BR />
<input type="text" id="answer" readonly="readonly"/> (BOX 3) -- Your calculated Retail Profit Share Award for today (for yesterday's business) according to the multiplier provided by this site's webmaster.<BR /><BR />
(Box 3 changes immediately as you input into Box 1.)<BR /><BR />
If you see a positive answer in Box 3 above, Zeek was profitable last night!<BR /><BR />
Should you see a discrepancy (other than a minor rounding difference), make sure you entered your correct VIP points. Please do not contact the webmaster for support; direct support calls to your sponsor. If both you and your sponsor have double-checked the calculations and feel that the multiplier is incorrect, please contact this webmaster.<BR /><BR />
TIP: Keep two browser tabs (Internet Explorer, Firefox or Chrome) open to your Zeek Rewards site and this site 24/7; don't close the tabs! You'll be visiting each day anyway! Didn't know you could do that?</p>
<p style="color:red">
NOTE: No results are guaranteed but not much in life is! As for Zeek Rewards and their Retail Profit Pool, it's very simple: If they make a profit, we can earn a share in that pool by qualifying. And qualifying is not hard! If Zeek does not make a profit on any given day, we have potential income streams other than the daily pool. Please protect your Zeek business (and mine) by getting proper training for what we can and cannot say about this revolutionary business model.</p>
<p>Best of luck to you with Zeek Rewards!</p>
<p>Legal Disclaimers</p>
<p>Income Disclosure Statement</p>
</form>
</blockquote></blockquote>
<script type="text/javascript">
function calculate () {
// The Calculation: change operator in this equation to change the calculation
document.getElementById("v1").value=document.getElementById("v1").value.replace(/[^0-9]/, '')*1
document.getElementById("v1").style.backgroundColor="yellow";
ans = document.getElementById("v1").value /100 * document.getElementById("v2").value;
document.getElementById("v2").style.backgroundColor="red";
if (!isNaN(ans)&&ans!=0){
document.getElementById("answer").value = "$"+ans.toFixed(2);
document.getElementById("answer").style.backgroundColor="lightgreen";
} else {
document.getElementById("answer").value = "";
document.getElementById("answer").style.backgroundColor="white";
}
}
</script>
</BODY>
</HTML>
Also, I would rather have the calculator have a button called "Calculate" and have the operation execute only after the visitor presses the button.