Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Firefox 2

Status
Not open for further replies.

pkailas

Programmer
Jun 10, 2002
555
US
I'm using the following code to pass the values of 2 check boxes besides a session variable. This works fine in IE but clicking the button does nothing in Firefox. If I remove the "&DC=' + decal.checked + '&SN=' + sign.checked;" section Firefox will send to the next page, but of course I lose my values I need to send.

Does anyone have any ideas?



<input type=submit on nclick="window.location.href=' + decal.checked + '&SN=' + sign.checked;" name=Update value="Next >>" style="<%=buttonn%>width:100;">

_______
I love small animals, especially with a good brown gravy....
 
Your code works in IE because IE allows "lazy coding practice" (where you use non-standard shortcuts). IMHO it should not, forcing people to learn correct usage. Annyway - you have several mistakes...

First: you have a space in "onclick", annd it is mis-spelled ("on nclick")... you should not - it should be one word. Next, you are accessing form elements without referencing them properly. You've also missed quotes from around many of your attribute values (although we don't know if they are required because we don't know what DOCTYPE you are working to).

Assuming your form elements have NAMES as per the names you are using in your code above (so "decal" and "sign"), this would be far more correct:

Code:
<input type="submit" onclick="window.location.href='[URL unfurl="true"]https://www.freelty.com/pay.asp?pid=<%=Session("FSID")%>&SSL=1&DC='[/URL] + this.form.elements['decal'].checked + '&SN=' + this.form.elements['sign'].checked;" name="Update" value="Next &gt;&gt;" style="<%=buttonn%>width:100px;">

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan,

the only reason that onclick was misspelled was because when I pasted it here I was trying to remove the line break. Otherwise, it was correct in my code. Having said that, I tried your solution with the same results. When I click in the "next >>" button, nothing happens in Firefox. IE still works fine.

Thanks though.



_______
I love small animals, especially with a good brown gravy....
 
[1] I guess the type should not be "submit", it should better be "button".
[2] decal and sign must be referenced with full path.
[3] Don't understand what kind of style is it: <%=buttonn%> and prefixed to width? So I take it out and let you put it back.

Try this?
[tt]
<input type="button"
onclick="window.location.href=' + this.form.decal.checked +
'&SN=' + this.form.sign.checked;"
name="Update" value="Next >>">
[/tt]
 
Nothing seems to make it work other than removing:

"&DC=' + decal.checked + '&SN=' + sign.checked"


I believe that something doesn't work in firefox that does work in IE when it comes to javascript. I'm clueless as what that is.

_______
I love small animals, especially with a good brown gravy....
 
Why don't you show what decal and sign are in the page?
>I believe that something doesn't work in firefox that does work in IE when it comes to javascript.
You repeat the same grievance. All the answers sofar address the issue and you keep repeating the same references to deal and sign. Why?
 
the only reason that onclick was misspelled was because when I pasted it here I was trying to remove the line break. Otherwise, it was correct in my code

Can you confirm that no other errors "crept in" while pasting your code? How are we to know there were no others given nwe don't have the source?

As Tsuji suggests, try changing the type="submit" to type="button" instead.

If it still fails open the JavaScript console in Firefox and see what errors you are getting.

Dan





Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
At a guess you have a quotes problem. Change it to something like onclick="fred ()" and in the <header> section add a <script language="Javascript"> segment to do whatever. I first hit this problem on IE4. Inline functions are a pain to maintain anyway since they are quite difficult to read. Since then I've always used a function. Works on everything: Mozilla, Opera, Netscape, IE variants.
 
xwb,

The error I get is "decal is not defined". where would I need to define it?

thanks,

_______
I love small animals, especially with a good brown gravy....
 
To all that assisted me. The problem was much more basic. I never declared my form. Since this is a large page that is dynamically altered and has a bunch of "CASE" type branches, it was easily overlooked! Once I declared my form inside the CASE, I was able to fix the problem. I had to change my "submit" to a button once I declared my form. So stars to everyone that was close!

Thanks again!

_______
I love small animals, especially with a good brown gravy....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top