...

View Full Version : Mac IE 5.5 button onClick issue



gtgart
07-06-2005, 09:10 AM
Hi,

I have a javascript calculator and it doesn't want to work properly on Mac IE 5.5 It will work on Netscape 7 and is fine on PC IE 6 etc.

Here is my code, I am wondering is there any other method for calling this javascript for the form?

<input name="Button3" type="button" class="buttonblue" value="Calculate" onClick="multiplyMonthlyCost(this.form)">

Thanks for any help, as I don't want to have to do a browser detect and go and get Netscape message.

Cheers,

Greg :)

Bill Posters
07-06-2005, 09:47 AM
Firstly, there is no such browser as IE5.5 for Mac. IE/Mac never got any higher than 5.2.3.


-

Without seeing the rest of the javascript as well as the rest of the form markup, it's hard to say for sure.

this.form refers to a form element or attribute within that input element, of which there are none (naturally).

If there is only one form on the page, you could try…

onClick="multiplyMonthlyCost(document.forms[0])"

If the form has an id attribute, you could try…

[code]onClick="multiplyMonthlyCost(document.forms['formId'])"
(where formId is the id of that form)

…but, as said, without seeing the larger context, it's hard to know the most appropriate way to pass the relevant info to the multiplyMonthlyCost() function.

Harry Armadillo
07-06-2005, 11:04 AM
this.form refers to a form element or attribute within that input element, of which there are none (naturally).
Actually, this.form refers the input's ancestral from. Rather that having to go through a chain of .parentNode and tests for .nodeName=='FORM', .form gives a direct reference. It's the complement to form's .elements object, and is a very handy way to abstract a function for use with multiple forms.

gtgart -- like Bill said, we'd need to the code for multiplyMonthlyCost (and any subroutines it uses), plus the HTML for the entire form.

Bill Posters
07-06-2005, 11:08 AM
Actually, this.form refers the input's ancestral from. Rather that having to go through a chain of .parentNode and tests for .nodeName=='FORM', .form gives a direct reference. It's the complement to form's .elements object, and is a very handy way to abstract a function for use with multiple forms.

gtgart -- like Bill said, we'd need to the code for multiplyMonthlyCost (and any subroutines it uses), plus the HTML for the entire form.

tbh, as I wrote it, I half expected someone to chime in and fill in what turns out to be a gap in my knowledge.
I happily stand (sit) corrected. ;)

…which is not to say that I totally understood your correction, but I'll read it again (and possibly again) until I geddit. :o

gtgart
07-07-2005, 04:03 AM
tbh, as I wrote it, I half expected someone to chime in and fill in what turns out to be a gap in my knowledge.
I happily stand (sit) corrected. ;)

…which is not to say that I totally understood your correction, but I'll read it again (and possibly again) until I geddit. :o

I take your point on Mac IE 5.2.3, and please find the page code attached.

Greg.

glenngv
07-07-2005, 06:27 AM
The source of the problem could be the toFixed() method. I think IE/Mac doesn't support it and it is buggy in IE5.5/Win. Use liorean's toDecimal() method (http://www.codingforums.com/showthread.php?p=178077#post178077) instead.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum