JS跨域的问题!!!高分求助!!!分不够再加!!!

wcbm 2007-10-23 02:25:28
http://a2.net.com/main.htm:
<iframe name=abc src="http://a1.net.com/ttt.htm"></iframe>
<input type="text" name="bbb" value="0" />


http://a1.net.com/ttt.htm:
<input type=button value=ok onclick="aaa();">
<SCRIPT LANGUAGE="JavaScript">
var i=0;
function aaa()
{
parent.document.getElementById("abc").height=i*30;
parent.document.getElementById("bbb").value=i;
i++;
}
</SCRIPT>
...全文
205 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
wcbm 2007-11-17
  • 打赏
  • 举报
回复
可以说得具体点吗?
chaonan 2007-10-24
  • 打赏
  • 举报
回复
你可以控制parent.document的title的属性

我就是成功利用在document的title属性解决这中问题的...
gu1dai 2007-10-24
  • 打赏
  • 举报
回复
who说firefox不支持呢,:)

楼主啊,慢慢调吧,已经不拒绝访问,你该给我分了,:)
yoyobp 2007-10-23
  • 打赏
  • 举报
回复
靠,欺负我打字慢,抢楼比我快
yoyobp 2007-10-23
  • 打赏
  • 举报
回复
document.domain= 'net.com '
不可以这么写
domain= 'net.com '

即使这样 firefox也不支持
wcbm 2007-10-23
  • 打赏
  • 举报
回复
document.domain= 'net.com '
这种方法我试了一下,我把所有页面全加上了还是不行
虽然没有出现拒绝访问,但我在子页面里面输出parent.document.getElementById("bbb")根本就为空
gu1dai 2007-10-23
  • 打赏
  • 举报
回复
在main.htm和aaa.htm的开头分别加上

document.domain='net.com'
如果引入了.js文件,那么,同样需要在开头加上document.domain='net.com'

这样域就统一了。OK
yoyobp 2007-10-23
  • 打赏
  • 举报
回复
不同域当然不可以,建议用服务器代理访问

http://a2.net.com/main.htm:
<iframe name=abc src="http://a2.net.com/agent.php?url=http://a1.net.com/ttt.htm" > </iframe >
<input type="text" name="bbb" value="0" / >
CutBug 2007-10-23
  • 打赏
  • 举报
回复
思归博客提到的的IFRAME的方法,应该可以
http://blog.joycode.com/saucer/archive/2006/10/03/84572.aspx
wcbm 2007-10-23
  • 打赏
  • 举报
回复
是这样的,因为在http://a1.net.com/ttt.htm在这个页面我要处理大量的东西,所以不方便再跳转
所以要求考虑最好能直接控制parent.document页面里面的东西
CutBug 2007-10-23
  • 打赏
  • 举报
回复
http://heimuad.javaeye.com/blog/post/387613
wcbm 2007-10-23
  • 打赏
  • 举报
回复
如果直接操作会提示“访问拒绝”啊
tantaiyizu 2007-10-23
  • 打赏
  • 举报
回复

怎么了?

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧