By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,704 Members | 1,475 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,704 IT Pros & Developers. It's quick & easy.

innerHTML not working in FIREFOX

omerbutt
100+
P: 638
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
Share this Question
Share on Google+
6 Replies


acoder
Expert Mod 15k+
P: 16,027
Check captcha.php?.jpg Does it show what you expect?
Aug 2 '08 #2

omerbutt
100+
P: 638
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
Expert Mod 15k+
P: 16,027
But you're saying it works in IE6?
Aug 2 '08 #4

omerbutt
100+
P: 638
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
Expert Mod 15k+
P: 16,027
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
100+
P: 638
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

Post your reply

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