说谎能不能被原谅:【求助】请教一个简单的JavaScript问题

来源:百度文库 编辑:高校问答 时间:2024/04/28 01:46:59
http://web.soaso.com/WebserviceX/pos/tellyou.htm
http://218.75.144.80/soaso.htm

高手帮忙看看,为什么第一个可以,第二个代码都改好却不行?
bird.aspx 里的代码已经有了结果,并非不允许跨域访问

<script>
function Gomore()
{
var fobj = document.DataForm;

for (i=0;i<fobj.length;i++)
{
if (fobj.item(i).type=="textarea")
{
if (fobj.item(i).value.length>0)
{
parent.addSomeG("",fobj.item(i).value);
}
}
}
parent.document.ghV.page.value = "1";

parent.step_.className = parent.ColorFinish;
}
function Gonothing()
{
Msssg = "第 0 页未含此网址, 点下一页继续.<br>";

parent.addSomeG("",Msssg);
parent.step_.className = parent.ColorNoInfo;

parent.document.ghV.page.value = "1";
}
function Gobad()
{
parent.step_.className = parent.ColorbvBad;
Msssg = "网站超时,<a href=javascript:ReGo('')>重新查询</a>.<br>";

parent.addSomeG("",Msssg);
}
function Gonotodownload()
{
parent.step_.className = parent.ColorbvNoDown;
Msssg = "第 0 页没有任何搜索结果.<br>";

parent.addSomeG("",Msssg);
parent.document.ghV.page.value = "1";

}
</script>

给个实例

IE:
<body>
<table width="200" border="1">
<tr>
<td bgcolor="#9900CC" onClick="alert(event.srcElement.innerhtml)"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>

FF:
<script language="javascript">
function run(evnt)
{
alert(evnt.target)
}
</script>
<body>
<table width="200" border="1">
<tr>
<td bgcolor="#9900CC" onClick="run(event);"> </td>
<td> </td>
<td> </td>
</tr>

</table>
</body>

客户端脚本是不允许跨域访问数据的,http://web.soaso.com/WebServiceX/pos/bird.aspx
是由于权限问题引起的。
解决办法是你从服务器脚本获取http://web.soaso.com/WebServiceX/pos/bird.aspx
的信息,反回给客户端

错误,就是不允许跨域造成的权限错误,你再仔细检查一下,尽量使用本地资源,看看代码里还有没有web.soaso.com等字词,有的话换成你自己的就可以了!

我在这里实验到北大天网就停住了,因此,我认为是网络不同造成的,因为google和baidu你可以通过电信或者网通上去,而天网的搜索引擎主要是在教育网内,虽然外网也可以上,但是搜索教育网内的东西就比较困难了