[thelist] JavaScript (Ajax) question - IE

Joshua Olson joshua at waetech.com
Wed Nov 9 20:35:15 CST 2005


> -----Original Message-----
> From: Tom Dell'Aringa
> Sent: Wednesday, November 09, 2005 9:15 PM
> 
> http://www.pixelmech.com/ajax/ajaxController.html
> 
> Click on 'colorado' and ajax loads a photo. Whippee. (you'll 
> see the request object alert) Problem
> is, in IE I get the old JS error "object does not support 
> this property or method". The
> problematic area seems to be my request setup for the XmlHttp object:

Tom,

I've had pretty good luck with this block of code for creating the object:

function jb()
{
  var A=null;
  try
  {
    A=new ActiveXObject("Msxml2.XMLHTTP")
  }
  catch(e)
  {
    try
    {
      A=new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch(oc)
    {
      A=null
    }
  }
  if(!A&&typeof XMLHttpRequest!="undefined")
  {
    A=new XMLHttpRequest()
  }
  return A
}  

It's the code Google first used when they launched Google Suggest, so I'm
fairly confident it'll work.  :-)

<><><><><><><><><><>
Joshua L. Olson
WAE Tech Inc.
http://www.waetech.com/
Phone: 706.210.0168 
Fax: 413.812.4864

Monitor bandwidth usage on IIS6 in real-time:
http://www.waetech.com/services/iisbm/





More information about the thelist mailing list