[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Javascript error in my code with IE6 only

Asked by EGormly in JScript

Tags: Javascript error icode IE6

I am having an issue with the following Javascript in Internet Explorer 6.
it displays an error in the IE6 toolbar, saying invalid.

it works fine in IE7,8 and Firefox. I NEED it to work in IE6, it's a requirement.
I didn't realize it didnt work until someone called me.. oops!

The script create an onload function and then attempts to retrive data from the primary source and if it fails it goes to a secondary.  I can't use a Body onLoad as it's already locked into a temple.  Thsi code orks flawlessly on other versions of IE.


Can someone take a look and see if there is something I can do to this script to make it play nice with IE6?

Code:
<script type="text/javascript">
window.onload = function()
{
     LoadPrimaryDataSourceURL("primary_resultsnew.asp"),init();
};
      function LoadPrimaryDataSourceURL(dest) {
            try {
                  var xreq = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {}                        
            xreq.onreadystatechange = function() {
                  if (xreq.readyState == 4) {
                        if (xreq.status == 200) {
                              document.getElementById("output").innerHTML = xreq.responseText;
                        }
                        else {
                              LoadBackupDataSourceURL("secondary_resultsnew.asp"); // Try this if we did not succeed...
                        }
                  }
            }
            xreq.open("GET", dest, true);
            xreq.send(null);
      }
      
      function LoadBackupDataSourceURL(dest) {
            try {
                  var xreq = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {}
            
            xreq.onreadystatechange = function() {
                  if ((xreq.readyState == 4) && (xreq.status == 200)) {
                        document.getElementById("output").innerHTML = xreq.responseText;
                  }
            }
            xreq.open("GET", dest, true);
            xreq.send(null);
      }
                    </script>                    
                   
<div id="loading" style="position:top; width:100%; text-align:center; color : 666699; font-size:14px; font-family : Verdana, Arial, Helvetica, sans-serif; top:300px;";>
            <br>Please wait while your request is being processed.<br><br>
            <img src="loadingajax.gif" border=0></div>
            <script>
                              var ld=(document.all);
                              var ns4=document.layers;
                              var ns6=document.getElementById&&!document.all;
                              var ie4=document.all;
                              if (ns4)
                                    ld=document.loading;
                              else if (ns6)
                                    ld=document.getElementById("loading").style;
                              else if (ie4)
                                    ld=document.all.loading.style;
                              function init()
                              {
                                    if(ns4){ld.visibility="hidden";}
                                    else if (ns6||ie4) ld.display="none";
                              }
            </script>
<div id="output"></div>
[+][-]11/09/09 02:24 AM, ID: 25774672Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/16/09 08:51 AM, ID: 25831676Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/18/09 06:45 AM, ID: 25850213Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/18/09 07:13 AM, ID: 25850523Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/18/09 07:27 AM, ID: 25850668Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/18/09 07:34 AM, ID: 25850766Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625