473,395 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

innerHTML not working in FIREFOX

omerbutt
638 512MB
hi there i have a registration page on which i have a captcha verification method i customized that code for the sake that the user is able to refresh the captcha images by staying on the same page via AJAX ,now the code i have written works perfect in IE6 , the user clicks the Refresh button and the new images is populated but when using FIREFOX it is doing nothing, i have placed the Captcha Image inside a div and on getting response(the new image) i throw that text inside the div via innerHTML but i is not replacing the image in FIREFOX ALTHOUGH THERE IS NO ERROR IN THE JAVASCRIPT AND THE FIRBUG SHOWS THE RESPONSED IMAGE TAG i tried to replace the image src also rather than overwriting the innerHTML of the div by splitting the response but still no use for that
i have to upoload that site today i am in a mess really the cross browser issues making me sick :s the code is here
filename=resistration.php
Expand|Select|Wrap|Line Numbers
  1.  <script type="text/javascript" language="javascript">
  2. function ref_captcha(){
  3.     refCapObj=GetXmlHttpObject();
  4.     var url="img_refresh.php";
  5.     if(refCapObj==null){
  6.         alert("you need to upgrade your browser");
  7.         return;
  8.     }else{
  9.         refCapObj.onreadystatechange=st_captcha;
  10.         refCapObj.open("GET",url,true);
  11.         refCapObj.send(null);
  12.     }
  13. }
  14. function st_captcha(){
  15.     if(refCapObj.readyState==4){
  16.         if(refCapObj.status==200){
  17.             document.getElementById("captcha_img").innerHTML=refCapObj.responseText;
  18.         }
  19.     }
  20. }
  21. </script>
  22.  
Expand|Select|Wrap|Line Numbers
  1. <tr>
  2.  <td align="left" valign="middle">
  3. <div id="captcha_img">
  4. <img src="captcha/captcha.php?.jpg" alt="If Image is not showing, refresh this page" />
  5. </div>
  6. </td>
  7. <td align="center" valign="bottom" width="200" class="text_grey_12">
  8. <div id="ref_captcha" style="cursor:pointer;" onmouseover="ld_img();" onmouseout="unld_img();" onclick="ref_captcha();">
  9. <div id="ref_img"></div>Refresh Image</div>
  10. </td>
  11. </tr>
  12.  
filename="img_refresh.php"
Expand|Select|Wrap|Line Numbers
  1. <?
  2.     echo "<img src='captcha/captcha.php?.jpg' alt='If Image is not showing, refresh this page' />";
  3. ?>
  4.  
Aug 2 '08 #1
6 6076
acoder
16,027 Expert Mod 8TB
Check captcha.php?.jpg Does it show what you expect?
Aug 2 '08 #2
omerbutt
638 512MB
Check captcha.php?.jpg Does it show what you expect?
yes acoder actually i have misinterpreted a lil thing and hat was , that i was getting the reponse and the images was generated also but it was generating the same image that was being generated previously and it looked like that the innerHTML was not working and not replacing the image but it is some other case it isnot generatingthe new captcha string :(
Aug 2 '08 #3
acoder
16,027 Expert Mod 8TB
But you're saying it works in IE6?
Aug 2 '08 #4
omerbutt
638 512MB
But you're saying it works in IE6?
yes exacly :( if the way i have done it , if it isnt generating a new string and not updating/overwriting the session variable then how come it is updating in IE6 :S
Aug 3 '08 #5
acoder
16,027 Expert Mod 8TB
You may need to ask in the PHP forum for the problem in your PHP code.

Usually IE has a problem with caching GET requests. Perhaps you could try adding a unique parameter to the end of the URL and see if that helps.

PS. you should really be testing in a more standards-compliant browser first to make cross-browser coding easier for yourself.
Aug 3 '08 #6
omerbutt
638 512MB
You may need to ask in the PHP forum for the problem in your PHP code.

Usually IE has a problem with caching GET requests. Perhaps you could try adding a unique parameter to the end of the URL and see if that helps.

PS. you should really be testing in a more standards-compliant browser first to make cross-browser coding easier for yourself.
k i check that acoder thanks for the reply ,
regards,
omer
Aug 3 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: webdev | last post by:
Hi, I'm writing an extensible form - it contains one name field to start and an "Add another name" button, so you can add as many bnames as required and then submit the form. Sounds simple and I...
14
by: catorcio | last post by:
I'm trying to have some text in my page changed by clicking a button. Googleing around I've discovered that innerText doesn't work with every browser, so I've switched to innerHTML. It works fine...
10
by: Jake Barnes | last post by:
This weekend I wanted to learn AJAX, so I set up a little toy page where I could experiment. The idea of this page is that you click in one of the boxes to get some controls, at which point you can...
9
by: Hallvard B Furuseth | last post by:
Why does the FAQ (Q 4.15) recommend innerHTML when so many here say one should use createElement(), replaceChild() etc? Also, why does the "Alternative DynWrite function" at...
2
by: sveinn | last post by:
Hi all, I've read through this group searching for an answear about this problem. Few have come close but not quite what I need. My problem is this: I'm using Ajax to fetch a new table with...
7
by: Hoss | last post by:
Hello all- This is what im trying to achieve. At the top of my page there is some search functionality, through which you cause to be loaded a string representing an HTML page. Below this and...
4
by: tcole6 | last post by:
My problem appears to be Firefox specific. I have a hyperlink that loads a new window. This window contains hyperlinks that call javascript functions in the parent window and then closes the...
6
by: sonic | last post by:
Ok, i am sure everyone is sick of hearing about this. but i've checked about 10 different posts/sites about this issue, and they all say "use DOM" but i think there is more to be said. Perhaps I...
3
by: Fredyy | last post by:
i am simply updating the innerHTML of a TD with text (replacing '\n' with '<br />'). In firefox, if i add one line to the existing i.e. Changing: 123 Your Street Town, State 12345 To: 123...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.