Jump to content

Ajax Loader Issue


Canman2005

Recommended Posts

Hi all

 

I'm using the following script to pull the contents of a page into a SPAN tag

 

function ajaxLoader(url,id) {
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
el = document.getElementById(id);
        el.innerHTML = "";

      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", url, true);
    x.send(null);
  }
}

 

the SPAN is created with

 

<span id="myspan"></span>

 

and then I do the link to pull in content using

 

<a onclick="ajaxLoader('mypage.php','myspan');">

 

This works great as a normal text link and in FireFox I don't get any problems using it anywhere.

 

The issue I have is using it in a list menu in IE, if I apply the onclick to

 

<select name="list" onmousedown="ajaxLoader('mypage.php','myspan');">

<option value="">Option 1</option>

<option value="">Option 2</option>

</select>

 

then it works fine, but if I apply it like

 

<select name="list">

<option onmousedown="ajaxLoader('mypage.php','myspan');" value="">Option 1</option>

<option onmousedown="ajaxLoader('mypage.php','myspan');" value="">Option 2</option>

</select>

 

then it refuses to work.

 

Any ideas why issues in IE?

 

Help :(

 

Thanks

 

Ed

Link to comment
https://forums.phpfreaks.com/topic/129553-ajax-loader-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.