I'm trying to do a post in my asp page through a Javascript statement. It works fine when i use IE, but with Firefox it doesn't. I've to make it works for both browsers. Any idea?
IE has this annoying thing called "quirks mode", where it attempts to guess what the developer had in mind when writing the code, but the code isn't correct. In this case, IE guessed right, so that's why it works in IE but not FF (nor, I guess, would it work in Safari, Opera, Konqueror, etc.)
Firstly, you have quoting issues. While "" works within a string in ASP and ColdFusion, JavaScript doesn't understand. You'd have to escape a single " with a backslash \.
Also, the beginning and ending of the string should be defined by one kind of quote (' or "), while parameters inside should be marked using whichever isn't used to start/end the string (ie, "This is the 'beginning' of the string" or 'This is the "end" of the string').
Yet another issue is - you are trying to place a <script> inside a <script>, and <script> tags don't nest. Well, not very well, anyway. You could jam that square peg into the round hole, but it would be a lot of work, and just not worth doing, IMHO.
Bookmarks