Current location: Hot Scripts Forums » General Web Coding » JavaScript » works great on IE but not on FireFox or Chrom, Why ?


works great on IE but not on FireFox or Chrom, Why ?

Reply
  #1 (permalink)  
Old 08-02-09, 09:38 PM
Wanasa Wanasa is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
works great on IE but not on FireFox or Chrom, Why ?

Hi everyone,

am facing a problem about the running an AJAX (java script) that save visitros posted comments into a database and show it. For this i've searched and found a great JS file called prototype.js it helped me will. but latelly i've been formed that it don't work on firefox and chrome also.

the javascript files are attached and the template code is here :
HTML Code:
<table class="table2">
 <tr>
 <td class="thead21">
    {viewfile_addcomment}
    </td>
 </tr>
 <tr>
 <td class="alt21">
 <form id="post-comment" onsubmit="return false;">
 <table border="0" width="100%">
 <tr>
 <td><textarea name="comment" id="comment"></textareaintemplate></td>
 </tr>
 <tr>
 <td align="right">
<input type="submit" name="OK" value="{viewfile_addcomment}" class="button" onClick="sendRequest()" />
</td>
 </tr>
 </table>

 <input type="hidden" name="operation" value="addComment" />
 <input type="hidden" name="userid" value="{USERID}" />
 <input type="hidden" name="fileid" value="{FILEID}" />
 </form>

 </td>
 </tr>
 </table>
the botton is not working in FF or chrome but it do in IE.
thankx in advance everyone,
Attached Files
File Type: zip javascripts.zip (22.5 KB, 14 views)
Reply With Quote
  #2 (permalink)  
Old 08-03-09, 02:53 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
In Firefox, what error do you get in the Error Console?
Reply With Quote
  #3 (permalink)  
Old 08-03-09, 04:55 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
You could try changing </textareaintemplate> to </textarea>.
Reply With Quote
  #4 (permalink)  
Old 08-03-09, 05:31 AM
Wanasa Wanasa is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Nico View Post
In Firefox, what error do you get in the Error Console?
i don't get any error reports no respons what so ever.

Quote:
Originally Posted by wirehopper View Post
You could try changing </textareaintemplate> to </textarea>.
sorry didn't clear this, i used this way to over come the problem of opning an HTML template in side a textarea.
Reply With Quote
  #5 (permalink)  
Old 08-03-09, 02:03 PM
krishardy krishardy is offline
Newbie Coder
 
Join Date: Aug 2009
Location: Columbus, OH
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Where is the element with the id of "show"? I don't see it anywhere here.

You need to refer to the form elements by ID in your javascript:

Code:
<input type="hidden" name="operation" value="addComment" />
 <input type="hidden" id="userid" name="userid" value="{USERID}" />
 <input type="hidden" id="fileid" name="fileid" value="{FILEID}" />

Here's what you could do with "comment-ajax.<acronym title="JavaScript">js</acronym>" to start tracing the error if there is a failure. Prototype fails silently (or with very little detail) unless you tell it what it should do when it fails.


Code:
function sendRequest() {
    new Ajax.Request("commentajax.php", 
    { 
        method: 'post',
        postBody: "userid=" + $F('userid') + "&fileid=" + $F('fileid') + "&comment=" + $F('comment'),
        onComplete: showResponse,
        onFailure: function(transport) {
            var message = "<br />Failure: (Status = "+transport.status + ") " + transport.statusText + ". " + transport.responseText + "<br />";
            $('debug').innerHTML += message;
        },
        onException: function(transport, exception) {
            var message = "Exception: ("+transport.status + ") " + transport.statusText + ". " + transport.responseText;
            message += "<br />**********<br />";
            message += "exception = " + exception+ "<br />";
            $('debug').innerHTML += message;
        }
    });
}

In your HTML, add:
Code:
<div id="debug"></div>
If you're using firebug, replace all
Code:
$('debug').innerHTML += message;
with

Code:
console.log(message);

(Remove all references to "debug" when your app goes into public use, or wrap your debugging log functions into a separate function that you can disable when your app goes live)

-Kris

Last edited by krishardy; 08-03-09 at 02:09 PM.
Reply With Quote
  #6 (permalink)  
Old 08-03-09, 06:30 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
You should also run CSS and HTML validators on the code. The W3C Markup Validation Service
Reply With Quote
  #7 (permalink)  
Old 08-04-09, 01:35 PM
Wanasa Wanasa is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
problem fixed.
it was as krishardy said, it was the id thing.

thankx all of you guys.

Quote:
You should also run CSS and HTML validators on the code. The W3C Markup Validation Service
thankx man i'll try it right now to check all other things in the style.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image replace works in IE - not FireFox patter JavaScript 4 09-23-07 07:41 PM
page works in firefox but not IE aburrows182 HTML/XHTML/XML 2 04-29-07 06:39 PM
HELP HS random_banner - works great, but not from my forum?? :-( Sarchi PHP 8 09-05-06 04:50 PM
login script works fine in firefox, nothing in IE! varial PHP 3 03-14-05 08:36 AM


All times are GMT -5. The time now is 01:54 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.