K
Kim14
I have a table that works fine in IE, but doesn't work in Netscape or
Firefox. It should automatically come up with numbers in some of the
fields and depending what is entered, it should calculate and come up
with a dollar amount.
If anyone out there sees what I am doing wrong- could you offer some
advice? I apologize in advance for adding the entire code- I know it
is more than most of you are willing to look at, but I just can't
figure out what part of it I messed up. Here it is:
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<TD valign="top" align="left" width="1" bgcolor="#6633CC"></TD>
<TD valign="top" align="left">
<!-- #BeginEditable "body" -->
<TABLE width="100%" border="0" cellspacing="0" cellpadding="5"
align="center">
<TR>
<TD>
<br><br><br><br>
<HR size="1" noshade>
<FORM name="calculator">
<TABLE width="95%" border="1" cellspacing="0"
cellpadding="3" align="center" bgcolor="#6699CC">
<TR>
<TD>
<SCRIPT language="JavaScript"><!-- hide script
function currency(anynum) {
//-- Returns passed number as string in $xxx,xxx.xx format.
anynum=eval(anynum)
workNum=Math.abs((Math.round(anynum*100)/100));workStr=""+workNum
if (workStr.indexOf(".")==-1){workStr+=".00"}
dStr=workStr.substr(0,workStr.indexOf("."));dNum=dStr-0
pStr=workStr.substr(workStr.indexOf("."))
while (pStr.length<3){pStr+="0"}
//--- Adds comma in thousands place.
if (dNum>=1000) {
dLen=dStr.length
dStr=parseInt(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen)
}
//-- Adds comma in millions place.
if (dNum>=1000000) {
dLen=dStr.length
dStr=parseInt(""+(dNum/1000000))+","+dStr.substring(dLen-7,dLen)
}
retval = dStr + pStr
//-- Put numbers in parentheses if negative.
if (anynum<0) {retval="("+retval+")"}
return "$"+retval
}
//-- Do the calculation based on three passed values.
function calc() {
//--Evaluate expression and display in appropriate table cell.
exemption = 500
tax = 0.0016
rounded_num = (Math.ceil(document.calculator.value01.value/500) * 500)
// the variable number without dollars and commas.
document.calculator.value02.value = currency(rounded_num) // adding
dollars and commas.
document.calculator.value03.value = exemption
document.calculator.value04.value = currency(rounded_num - exemption)
// adding dollars and commas.
document.calculator.value05.value = tax
total = (rounded_num - exemption) * tax
document.calculator.total.value = currency(total) //adding dollars and
commas.
}
// unhide script -->
</SCRIPT>
<B><div align="center"><font size="+1">Iowa Real
Estate Transfer Tax
Calculator</font></div></font></B><NOSCRIPT>Requires
JavaScript enabled to operate.</NOSCRIPT>
<HR size="1">
<I> <div style="text-align:justify;">Type your
numeric value in the appropriate boxes, then
click anywhere outside that box or press the Tab
Key for the
total amount due.</I> <I>Do not type commas (,) or
dollar
signs ($) into number fields. Press TAB for
result</div></I>
<TABLE align="center" cellpadding="3"
cellspacing="0" width="100%">
<TR align="left" valign="middle"
bgcolor="#6699CC">
<TD align="right">$</TD>
<TD align="right">
<INPUT name="value01" size="15"
onChange="calc()" maxlength="10">
</TD>
<TD align="left" colspan="2">Total Amount
Paid</TD>
</TR>
<TR align="left" valign="middle">
<TD align="right">= $</TD>
<TD align="right">
<INPUT name="value02" size="15" value="0"
maxlength="0">
</TD>
<TD align="left" colspan="2">Rounded Up to
Nearest $500
Increment</TD>
</TR>
<TR align="left" valign="middle">
<TD align="right">- $</TD>
<TD align="right">
<INPUT name="value03" size="15" value="500"
maxlength="0">
</TD>
<TD align="left" colspan="2">Exemption</TD>
</TR>
<TR align="left" valign="middle">
<TD align="right">= $</TD>
<TD align="right">
<INPUT name="value04" size="15" maxlength="0"
value="0">
</TD>
<TD align="left" colspan="2">Taxable
Amount</TD>
</TR>
<TR align="left" valign="middle">
<TD align="right">x $</TD>
<TD align="right">
<INPUT name="value05" size="15" maxlength="0"
value=".0016">
</TD>
<TD align="left" colspan="2">Tax</TD>
</TR>
<TR align="left" valign="middle"
bgcolor="#6699CC">
<TD align="right" colspan="2"><FONT
color="#000000"><B>
Amount Due = $</B></FONT></TD>
<TD align="left">
<INPUT name="total" size="15" maxlength="0">
</TD>
<TD align="left">
<INPUT type="button" name="button"
value="Submit" onClick="calc()">
<INPUT type="reset" name="Reset"
value="Reset">
</TD>
</TR>
</TABLE>
<DIV align="center">
<HR size="1">
</DIV>
</TD>
</TR>
</TABLE>
</FORM>
<SCRIPT language="JavaScript">
<!--
//-- This little script, executed after form has been rendered,
//-- puts the cursor into the userName field so it's ready when page
opens.
// document.calculator.value01.focus()
// -->
</SCRIPT>
<HR size="1" noshade>
<P><div style="text-align:justify;">You may calculate real
estate transfer tax by entering the total
amount paid for the property. This calculation is based
on $1.60
per thousand and the first $500 is exempt.</div></P>
</TD>
</TR>
</TABLE>
<!-- #EndEditable -->
</TD>
</TR>
</TABLE>
<TABLE width="700" border="0" cellspacing="0" cellpadding="5"
align="center" bgcolor="#006600">
<TR>
<TD><FONT size="-1" color="#FFFFFF"><B></B></FONT></TD>
</TR>
</TABLE>
</BODY>
Firefox. It should automatically come up with numbers in some of the
fields and depending what is entered, it should calculate and come up
with a dollar amount.
If anyone out there sees what I am doing wrong- could you offer some
advice? I apologize in advance for adding the entire code- I know it
is more than most of you are willing to look at, but I just can't
figure out what part of it I messed up. Here it is:
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<TD valign="top" align="left" width="1" bgcolor="#6633CC"></TD>
<TD valign="top" align="left">
<!-- #BeginEditable "body" -->
<TABLE width="100%" border="0" cellspacing="0" cellpadding="5"
align="center">
<TR>
<TD>
<br><br><br><br>
<HR size="1" noshade>
<FORM name="calculator">
<TABLE width="95%" border="1" cellspacing="0"
cellpadding="3" align="center" bgcolor="#6699CC">
<TR>
<TD>
<SCRIPT language="JavaScript"><!-- hide script
function currency(anynum) {
//-- Returns passed number as string in $xxx,xxx.xx format.
anynum=eval(anynum)
workNum=Math.abs((Math.round(anynum*100)/100));workStr=""+workNum
if (workStr.indexOf(".")==-1){workStr+=".00"}
dStr=workStr.substr(0,workStr.indexOf("."));dNum=dStr-0
pStr=workStr.substr(workStr.indexOf("."))
while (pStr.length<3){pStr+="0"}
//--- Adds comma in thousands place.
if (dNum>=1000) {
dLen=dStr.length
dStr=parseInt(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen)
}
//-- Adds comma in millions place.
if (dNum>=1000000) {
dLen=dStr.length
dStr=parseInt(""+(dNum/1000000))+","+dStr.substring(dLen-7,dLen)
}
retval = dStr + pStr
//-- Put numbers in parentheses if negative.
if (anynum<0) {retval="("+retval+")"}
return "$"+retval
}
//-- Do the calculation based on three passed values.
function calc() {
//--Evaluate expression and display in appropriate table cell.
exemption = 500
tax = 0.0016
rounded_num = (Math.ceil(document.calculator.value01.value/500) * 500)
// the variable number without dollars and commas.
document.calculator.value02.value = currency(rounded_num) // adding
dollars and commas.
document.calculator.value03.value = exemption
document.calculator.value04.value = currency(rounded_num - exemption)
// adding dollars and commas.
document.calculator.value05.value = tax
total = (rounded_num - exemption) * tax
document.calculator.total.value = currency(total) //adding dollars and
commas.
}
// unhide script -->
</SCRIPT>
<B><div align="center"><font size="+1">Iowa Real
Estate Transfer Tax
Calculator</font></div></font></B><NOSCRIPT>Requires
JavaScript enabled to operate.</NOSCRIPT>
<HR size="1">
<I> <div style="text-align:justify;">Type your
numeric value in the appropriate boxes, then
click anywhere outside that box or press the Tab
Key for the
total amount due.</I> <I>Do not type commas (,) or
dollar
signs ($) into number fields. Press TAB for
result</div></I>
<TABLE align="center" cellpadding="3"
cellspacing="0" width="100%">
<TR align="left" valign="middle"
bgcolor="#6699CC">
<TD align="right">$</TD>
<TD align="right">
<INPUT name="value01" size="15"
onChange="calc()" maxlength="10">
</TD>
<TD align="left" colspan="2">Total Amount
Paid</TD>
</TR>
<TR align="left" valign="middle">
<TD align="right">= $</TD>
<TD align="right">
<INPUT name="value02" size="15" value="0"
maxlength="0">
</TD>
<TD align="left" colspan="2">Rounded Up to
Nearest $500
Increment</TD>
</TR>
<TR align="left" valign="middle">
<TD align="right">- $</TD>
<TD align="right">
<INPUT name="value03" size="15" value="500"
maxlength="0">
</TD>
<TD align="left" colspan="2">Exemption</TD>
</TR>
<TR align="left" valign="middle">
<TD align="right">= $</TD>
<TD align="right">
<INPUT name="value04" size="15" maxlength="0"
value="0">
</TD>
<TD align="left" colspan="2">Taxable
Amount</TD>
</TR>
<TR align="left" valign="middle">
<TD align="right">x $</TD>
<TD align="right">
<INPUT name="value05" size="15" maxlength="0"
value=".0016">
</TD>
<TD align="left" colspan="2">Tax</TD>
</TR>
<TR align="left" valign="middle"
bgcolor="#6699CC">
<TD align="right" colspan="2"><FONT
color="#000000"><B>
Amount Due = $</B></FONT></TD>
<TD align="left">
<INPUT name="total" size="15" maxlength="0">
</TD>
<TD align="left">
<INPUT type="button" name="button"
value="Submit" onClick="calc()">
<INPUT type="reset" name="Reset"
value="Reset">
</TD>
</TR>
</TABLE>
<DIV align="center">
<HR size="1">
</DIV>
</TD>
</TR>
</TABLE>
</FORM>
<SCRIPT language="JavaScript">
<!--
//-- This little script, executed after form has been rendered,
//-- puts the cursor into the userName field so it's ready when page
opens.
// document.calculator.value01.focus()
// -->
</SCRIPT>
<HR size="1" noshade>
<P><div style="text-align:justify;">You may calculate real
estate transfer tax by entering the total
amount paid for the property. This calculation is based
on $1.60
per thousand and the first $500 is exempt.</div></P>
</TD>
</TR>
</TABLE>
<!-- #EndEditable -->
</TD>
</TR>
</TABLE>
<TABLE width="700" border="0" cellspacing="0" cellpadding="5"
align="center" bgcolor="#006600">
<TR>
<TD><FONT size="-1" color="#FFFFFF"><B></B></FONT></TD>
</TR>
</TABLE>
</BODY>