innerHTML not working in FIREFOX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    innerHTML not working in FIREFOX

    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=resist ration.php
    [CODE=javascript]
    <script type="text/javascript" language="javas cript">
    function ref_captcha(){
    refCapObj=GetXm lHttpObject();
    var url="img_refres h.php";
    if(refCapObj==n ull){
    alert("you need to upgrade your browser");
    return;
    }else{
    refCapObj.onrea dystatechange=s t_captcha;
    refCapObj.open( "GET",url,true) ;
    refCapObj.send( null);
    }
    }
    function st_captcha(){
    if(refCapObj.re adyState==4){
    if(refCapObj.st atus==200){
    document.getEle mentById("captc ha_img").innerH TML=refCapObj.r esponseText;
    }
    }
    }
    </script>
    [/CODE]
    [code=html]
    <tr>
    <td align="left" valign="middle" >
    <div id="captcha_img ">
    <img src="captcha/captcha.php?.jp g" alt="If Image is not showing, refresh this page" />
    </div>
    </td>
    <td align="center" valign="bottom" width="200" class="text_gre y_12">
    <div id="ref_captcha " style="cursor:p ointer;" onmouseover="ld _img();" onmouseout="unl d_img();" onclick="ref_ca ptcha();">
    <div id="ref_img"></div>Refresh Image</div>
    </td>
    </tr>
    [/code]
    filename="img_r efresh.php"
    [code=php]
    <?
    echo "<img src='captcha/captcha.php?.jp g' alt='If Image is not showing, refresh this page' />";
    ?>
    [/code]
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Check captcha.php?.jp g Does it show what you expect?

    Comment

    • omerbutt
      Contributor
      • Nov 2006
      • 638

      #3
      Originally posted by acoder
      Check captcha.php?.jp g 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 :(

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        But you're saying it works in IE6?

        Comment

        • omerbutt
          Contributor
          • Nov 2006
          • 638

          #5
          Originally posted by acoder
          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

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            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.

            Comment

            • omerbutt
              Contributor
              • Nov 2006
              • 638

              #7
              Originally posted by acoder
              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

              Comment

              Working...