"Tom Cahill" <nospam@nowau.com> writes:
[color=blue]
> The following code will work perfectly on a PC browser, IE or Netscape.
> However on a Mac browser (IE, Netscape, or Safari) it does not. I have tried
> it on OSX and OS9.[/color]
HOW does it not work? You are missing the three R's of bug reporting:
The bug must be:
Reproducible: What must we do to reproduce the bug. You posted the
code, but not the page it depends on, so we cannot attempt to
reproduce the bug.
Recognizable: We must be able to see the bug when it happens. You
don't say how it fails, or what the normal behavior should be.
Repairable: We must know what the desired behavior is to be able
to suggest fixes.
You should also try to reduce the code to a small, self-contained
example that still exhibits the bug. Often, that procedure will
uncover the bug for yourself, and if not, it will make it much
easier to help you.
As it is, all I can offer is generalities:
[color=blue]
> var discount_cutoff = new Date("September 10, 2004"); // Cut off date for
> discounts[/color]
(And make sure your lines are less than ~72 characters when posting code
to Usenet. Your news client has broken this line into two, introducing a
syntax error that wasn't in the original.)
I would not rely on how Date parses strings. It is implementation
dependent. Instead, write:
var discount_cutoff = new Date(2004, 9-1, 10);
[color=blue]
> var today = new Date(); // Value to compare agains cut off date.
> var GST_TAX = 0.07; // Current GST rate 7%
>
> //get quantities for discounts and registrations
>
> var event1_reg_qty = parseInt(document.REGISTER.qty.value); //Converts
> quantity entered to an Integer for calculations[/color]
Reading from forms is safest done using the collections:
var event1_reg_qty = parseInt(
document.forms['REGISTER'].elements['qty'].value, 10)
Since you use it all the time, I would probably define a variable:
var form = document.forms['REGISTER'].elements;
Then you can just refer to it as "form['qty'].value".
Always add the second argument (", 10") to parseInt, or someone
entering the text "020" would be surpriced to have it read as octal
(giving 16). Alteratively, use the Number function for conversion,
if you don't want to allow trailing garbage.
[color=blue]
> document.REGISTER.sub_total.value = event1_fee.toFixed(2);[/color]
the toFixed function is known to be bugged in IE 5.5 (and doesn't
exist before, which perhpas rules out Mac IE 5.2). Which is a shame,
since it's probably just what you need.
<URL:http://jibbering.com/faq/#FAQ4_6>
....[color=blue]
> document.REGISTER.sub_total.value = "$" +
> FormatCurrency(document.REGISTER.sub_total.value);[/color]
it is inefficient to first store the toFixed(2) value in the text box, and
then fetch it back again and run it through FormatCurrency. Just do it in
one go.
document.forms['REGISTER'].elements['sub_total'].value =
"$" + FormatCurrency(event1_fee.toFixed(2));
Is both toFixed and FormatCurrency really needed?
[color=blue]
> if (WithoutContent(document.REGISTER.Registrant2_Firs tName.value) == false)[/color]
Just as a style hint: never compare with a boolean. Just do
if (!WithoutContent(...))
[color=blue]
> var timeToKeep = 7200000; // two hours
> var expires = new Date();
> expires.setTime(expires.getTime() + timeToKeep);[/color]
Or
expires.setHours(expries.getHours()+2);
[color=blue]
> var cookie_name = "TAMcookie"
> set_cookie(cookie_name, total.toFixed(2), expires);[/color]
Are you sure the setting of the cookie works? We can't see
the "set_cookie" function, but try reading the cookie back
immediately and see that it is set correctly.
Good luck.
/L
--
Lasse Reichstein Nielsen -
lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'