在同域名下可以调用,在不同域名下就出现了undefined,我想可能是不支持跨域名,但为什么不支持呢,我不知道,如果的确不能,那有什么替代方法吗,请大家帮帮忙吧,我现在急需!
代码如下:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript">
<!--
function ss(w,id){window.status=w;return true;}
function cs(){window.status='';}
function init()
{
ad_service1.useService("http://www.***.com/godal/Info/Serves.asmx?WSDL","GetServices");
ad_service1.GetServices.callService(showCode,"GetServices","amG30LrScS5Qi","1");
}
function showCode(result)
{
ad_service1.innerHTML=result.value;
}
//-->
</script>
</head><body onload="init();">
<div id="ad_service1" style="behavior:url(webservice.htc)"></div>
</body>
</html>
代码如下:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript">
<!--
function ss(w,id){window.status=w;return true;}
function cs(){window.status='';}
function init()
{
ad_service1.useService("http://www.***.com/godal/Info/Serves.asmx?WSDL","GetServices");
ad_service1.GetServices.callService(showCode,"GetServices","amG30LrScS5Qi","1");
}
function showCode(result)
{
ad_service1.innerHTML=result.value;
}
//-->
</script>
</head><body onload="init();">
<div id="ad_service1" style="behavior:url(webservice.htc)"></div>
</body>
</html>
你的机子(客户端)为A点,
你的网站(服务端)为B点,
来自远程的WEBSERVICE为 C点。你的脚本从A点直接访问C点,是不允许的(所谓的不能跨域执行),
你只能利用B点先访问C点,然后再从A点访问B点。
(能利用B点先访问C点)就是以服务器端脚本先把C点的数据获取
其实还有另外一种实现,由于Active控件不允许跨站访问,但是image却可以跨站点访问,这找找这方面