日期:2014-05-17  浏览次数:20865 次

如何让 a.html中 链接1 在b.html中的名为right的 <iframe>中显示
当点击   a.html中   链接1   时在b.html中的名为right的   <iframe> 中显示   页面1
    点击   a.html中   链接2   时在b.html中的名为right的   <iframe> 中显示   页面2

如何实现阿?

------解决方案--------------------
整个问题的关键就是你想知道如何访问页面里的iframe
document.all.iFrameInA.contentWindow.document.all.iFrameInB.src=url;


a.html
[code]
<html>
<head>
<title> a.html </title>
<script language= "javascript ">
function change_link(url)
{
document.all.iFrameInA.contentWindow.document.all.iFrameInB.src=url;
}
</script>
</head>
<body bgcolor= "#006699 ">
here is a 's document body

<table border= "0 " width= "100% " cellpadding=0 cellspacing=0>
<tr>
<td width= "20% "> this is in a
<br/>
<a onclick= "change_link( 'link1.html ') "> link1 </a>
<br/>
<a onclick= "change_link( 'link2.html ') "> link2 </a>
</td>
<td style= "padding:10px ">
<iframe id= "iFrameInA " src= "b.html " width= "100% " frameborder=0 style= "border:1px solid gray "/>
</td
</tr>
</table>
</body>
</html>
[/code]

b.html
<html>
<head> </head>
<body>
here is b 's document body

<table border= "1 " width= "100% " cellpadding=0 cellspacing=0>
<tr>
<td width= "20% "> this is in b
<br/>
<a onclick= "change_link( ' ') "> link1 </a>
<br/>
<a onclick= "change_link( ' ') "> link2 </a>
</td>
<td>
<iframe id= "iFrameInB " frameborder=0 style= "border:1px solid gray "/>
</td
</tr>
</table>
</body>
</html>