毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> net技术 >> 正文

uncaught exception: [Exception... "Component returned failure code: 0x80040154 (NS_ERROR_FACTORY_NOT_REGISTERED) [nsIDOMWindowInternal.alert]"

更新时间:2012-6-7:  来源:毕业论文

js 调用WebService 火狐下无反应

script language="javascript" type="text/javascript"> 
function RequestByPost(value) {
  var xmlhttpps;
  try {
  xmlhttpps = new ActiveXObject("Msxml.XMLHTTP");
  } catch (a) {
  try {
  xmlhttpps = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (a) {
  xmlhttpps = false;
  }
  }
  if (!xmlhttpps && typeof XmlHttpRequest != 'undefined') {
  xmlhttpps = new XMLHttpRequest();
  }
  var data;
  data = '<?xml version="1.0" encoding="utf-8"?>';
  data = data + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
  data = data + '<soap:Body>';
  data = data + '<GetTime xmlns="http://tempuri.org/">';
  data = data + '<input>' + value + '</input>';
  data = data + '</GetTime>';
  data = data + '</soap:Body>';
  data = data + '</soap:Envelope>';

  //var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  // xmlhttp = createXMLHttp();
  // xmlHttpps = createXMLHttp;
  alert(xmlhttpps);
  var URL = "http://localhost/WebService/CityService.asmx";
  xmlhttpps.open("POST", URL, false);

  xmlhttpps.onreadystatechange = function () {

  if (xmlhttpps.readyState == 4) {
  if (xmlhttpps.status == 200) {
  document.getElementById("TextArea1").value = xmlhttpps.responseText;
  // alert(xmlhttpps.responseText);
  }
  }


  };

  xmlhttpps.SetRequestHeader("Content-Type", "text/xml; charset=gb2312");
  xmlhttpps.SetRequestHeader("SOAPAction", "http ://tempuri. org/GetTime");
  xmlhttpps.send(data);
   
  }
 
</Script>

<body>
<textarea id="TextArea1" name="S1" rows="10"></textarea>
<input type="button" value="CallWebserviceByPost" onclick="RequestByPost('hello')" />
</body>
------------webservice.cs----------------------------
 [WebMethod]
  public XmlNode GetTime(string input)
  {
  XmlDocument doc = new XmlDocument();
  doc.LoadXml("<envelope><date_time>" + input + " " + DateTime.Now.ToLongDateString() +
  DateTime.Now.ToLongTimeString() + "</date_time></envelope>");

  return doc.DocumentElement;
  }  
   


在IE下可以显示 
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="ht tp://schemas. xmlsoap. org/soap/envelope/" xmlns:xsi="h ttp: //www. w3. org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetTimeResponse xmlns="http://tempuri.org/"><GetTimeResult><envelope xmlns=""><date_time>hello 2011年6月25日 星期六16:41:27</date_time></envelope></GetTimeResult></GetTimeResponse></soap:Body></soap:Envelope>
-------------------------------------------------------------------------------
在火狐下出现如下提示:
[16:41:38.376] uncaught exception: [Exception... "Component returned failure code: 0x80040154 (NS_ERROR_FACTORY_NOT_REGISTERED) [nsIDOMWindowInternal.alert]" nsresult: "0x80040154 (NS_ERROR_FACTORY_NOT_REGISTERED)" location: "JS frame :: http://localhost/vssnet/test2.aspx :: RequestByPost :: line 166" data: no]

var URL = "http :// localhost /WebService/CityService.asmx/哪个方法";

JS不行就jquery 如果jquery还是不行就是你代码问题

自己debugger进去跟着 JS调试

或者 自己alert弹出一下

看看进入了 方法没有

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。