日期:2014-05-16  浏览次数:20372 次

JS跨域的问题!!!高分求助!!!分不够再加!!!
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>

------解决方案--------------------

怎么了?
------解决方案--------------------
http://heimuad.javaeye.com/blog/post/387613
------解决方案--------------------
思归博客提到的的IFRAME的方法,应该可以
http://blog.joycode.com/saucer/archive/2006/10/03/84572.aspx
------解决方案--------------------
不同域当然不可以,建议用服务器代理访问

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" / >
------解决方案--------------------
在main.htm和aaa.htm的开头分别加上

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

这样域就统一了。OK
------解决方案--------------------
document.domain= 'net.com ' 
不可以这么写
domain= 'net.com '

即使这样 firefox也不支持

------解决方案--------------------
靠,欺负我打字慢,抢楼比我快
------解决方案--------------------
who说firefox不支持呢,:)

楼主啊,慢慢调吧,已经不拒绝访问,你该给我分了,:)
------解决方案--------------------
你可以控制parent.document的title的属性

我就是成功利用在document的title属性解决这中问题的...