473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Table Works with IE- But Not Firefox or Netscape

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=d Str-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>

Jul 23 '05 #1
4 2056
This one's hard to spot and really funny. It's not a script error -
you've simply set the max length of your input fields to zero! :-D

Jul 23 '05 #2
Paul R-

You are a GENIUS!!! Are hugs allowed here???????? I'm not sure why IE
worked with the zero in the input fields, but now my other browsers are
working like they should.

I don't know how much longer I would have tried testing that page
before I realized what I had done wrong.

Thank you SO much for taking the time to look at the whole thing for
me!!!

Kim14

Jul 23 '05 #3
Kim14 wrote:
[...]
I'm not sure why IE worked with the zero in the input fields...


It depends on your definition of "worked".

IE displays your default values, but attempting to change them
results in exactly the same behaviour as Firefox - you can't
enter any text in the fields with maxlength="0".

It would appear that IE does not apply the value of the
maxlength attribute to the default value whereas Firefox does.

The HTML 4.01 spec says:

"...this attribute specifies the maximum number of characters
the user may enter."

Which I guess means that IE's approach is more compliant - it
only restricts what the user can enter and allows the value
attribute to be displayed (and submitted) regardless. Firefox
appears to remove the value completely - the value of the input
when submitted is empty.

--
Rob
Jul 23 '05 #4
Thanks so much to Paul & Rob for your help! I just didn't see my
error, no matter how many times I looked at it. And the explanation
was helpful just to see the differences between the browsers since I am
new to this.

I really appreciate the fact that you took the time to look at my whole
page, that is probably a big no-no to post so much information here.

Hugs to both of you!

Kim

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Adam | last post by:
Hi all, OK, I'm baffled. I have a menu in a table which I've just realized is "breaking apart" in Safari: http://www.fitcityforwomen.com/00-intro/index.html Yet when I plunk the menu by...
7
by: jon | last post by:
I'm trying to add a row to a table and I think I'm not doing something right. The sample code below contains a table with 4 single cell rows, a button and a javascript function that the button...
7
by: veronique rossi | last post by:
Hello, I have put a table in a scrollable DIV so that only one part of the table is visible. Now, I want that, when I scroll, the table is scrolled item by item in the table (as it is done when...
31
by: Arthur Shapiro | last post by:
I'm the webmaster for a recreational organization. As part of one page of the site, I have an HTML "Calendar at a Glance" of the organization's events for the month. It's a simple table of a...
4
by: Monte Gardner | last post by:
I'm trying to create an effect wherein an HTML page contains a large number of products (up to 125 possibly). Initially, only the first 3 are displayed. When the user clicks on a 'next' or...
1
by: Richard | last post by:
I have a table that is about 100 rows long and within that table I have tons of links. The table takes about 2 seconds to load. I think javascript might help somehow. The problem is that in...
5
by: SPE - Stani's Python Editor | last post by:
Hi, During optimizing SPE for Ubuntu, I found something strange. I have Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not working: >>> import webbrowser >>>...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
16
by: Dobedani | last post by:
Dear All, I found the code added below at: http://simplythebest.net/sounds/sound_guide.html Unfortunately, the code doesn't seem to work in Firefox. These are the error messages I can see in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.