createHttpRequest

  1. function createHttpRequest(){
  2. var request = null;
  3.  
  4. if (window.XMLHttpRequest){
  5. try{request = new XMLHttpRequest();}
  6. catch (e){}
  7. }else if (window.ActiveXObject){
  8. var names = new Array(
  9. 'Msxml2.XMLHTTP.5.0',
  10. 'Msxml2.XMLHTTP.4.0',
  11. 'Msxml2.XMLHTTP.3.0',
  12. 'Msxml2.XMLHTTP',
  13. 'Microsoft.XMLHTTP'
  14. );
  15. for (var i = 0, iMax = names.length; i < iMax; i++){
  16. try{
  17. request = new ActiveXObject(names[i]);
  18. break;
  19. }catch (e){}
  20. }
  21. }
  22. return request;
  23. }
  24.  
最終更新:2008年02月15日 17:26