[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
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

AJAX+M$ (spells desaster)

Asked by x_terminat_or_3 in JavaScript

Tags: ajax

Hi all

I have made a simple RPC to pull dynamically help texts from an xml file by using php and AJAX.

Everything works in both FireFox and M$ Explorer, with one exception:

If an element is already selected and the refresh button is pressed then m$ throws an error because apparently it fires the onfocus event before the onload event and my onload event is where the http object gets initialized.

Here is my script

                  // AJAX Functions
                  var helptitle='helptitle'; //name of the helptitle div
                  var helpbody='helpbody'; //name of the helpbody bidv
                  var cache=new Array();
                  var http;

                  function inithelp()
                  {
                        http=createRequestObject();
                        requesthelp('init');
                  }

                  function createRequestObject()
                  {
                        var reqobj;
                        var browser=navigator.appName;

                        if(browser.indexOf('Microsoft')!=-1)
                        {
                              reqobj=new ActiveXObject('Microsoft.XMLHTTP');
                        }
                        else
                              reqobj=new XMLHttpRequest();
                        return reqobj;
                  }

                  function requesthelp(field)
                  {
                        if(field=='init')
                        {field=new Object();
                         field.id='init';
                        }
                        if(in_cache(field.id))
                        {
                              get_cache(field.id);
                        }
                        else
                        {
                              http.open('get','contact.php?field='+field.id+'&action=help');
                              http.onreadystatechange=fillhelp;
                              http.send(null);
                        }
                  }

                  function in_cache(what)
                  {
                        if(cache.length>0)
                        {
                              try
                              {
                                    for(var counter=0; counter<cache.length; counter++)
                                          if(cache[what])
                                                return true;
                              }
                              catch(bug)
                              {
                                    ;
                              }
                        }

                        return false;
                  }

                  function get_cache(what)
                  {
                        try
                        {
                              fillhelp(cache[what]);
                        }
                        catch(bug)
                        {
                              ;
                        }
                  }

                  function fillhelp(fromcache)
                  {
                        var response,update;
                        var cheat=true;

                        if(fromcache==undefined)
                              cheat=false;

                        if( (http.readyState==4) || (cheat))
                        {
                              response=(cheat?fromcache:http.responseText);
                              update=new Array();

                              if(response.indexOf('|')!=-1)
                              {
                                    update=response.split('|');
                                    document.getElementById(helptitle).innerHTML=update[0];
                                    document.getElementById(helpbody).innerHTML=update[1];
                              }
                              if(!cheat)
                               cache[update[0]]=update[1];
                        }
                  }

[+][-]11/02/05 03:46 PM, ID: 15213213Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: JavaScript
Tags: ajax
Sign Up Now!
Solution Provided By: Zvonko
Participating Experts: 1
Solution Grade: A
 
[+][-]11/02/05 01:28 PM, ID: 15212198Expert 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/02/05 01:31 PM, ID: 15212215Author 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/02/05 01:32 PM, ID: 15212228Expert 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/02/05 01:35 PM, ID: 15212259Author 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/02/05 01:39 PM, ID: 15212299Expert 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/02/05 01:42 PM, ID: 15212315Author 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/02/05 01:44 PM, ID: 15212341Expert 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/02/05 01:45 PM, ID: 15212357Expert 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/02/05 01:46 PM, ID: 15212367Author 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/02/05 02:05 PM, ID: 15212541Expert 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/03/05 04:11 AM, ID: 15216133Author 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...
20091118-EE-VQP-93