首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

js 访问frame里面的元素解决办法

2013-11-08 
js 访问frame里面的元素main.htmlhtmlheadtitlemain/title/headframeset namemenu_fs rows

js 访问frame里面的元素
main.html

<html>
<head>
<title>main</title>
</head>
<frameset name="menu_fs" rows="150,150,300" border="0" framespacing="0" frameborder="0">
<frame id ="first_frame" src="first.html"></frame>
<frame id ="second_frame" src="second.html"></frame>
<frame id ="external_frame" id="df" src='http://www.baidu.com'></frame>
</frameset>
</html>

first.html 和second.html 是我本地的两个文件。我想在main.html里写一段js访问frame里的元素。

first.html跟second.html里的标签元素都可通过document.getElementById("xxx").contentDocument这样的类似的方法访问到,第三个写链接的却怎么也访问不到,求大神指教,给出解决方法啊 js?frame
[解决办法]
不能访问跨域的元素的  
你第三个跨域了
[解决办法]
同源安全策略  正规途径貌似不能

热点排行