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

★★★这种打开新窗口的方法该如何实现?
a.html页面用iframe的方式引用了某个网址   比如引用的是b.html

我是无法更改b.html的属性的,b.html里有超级链接,但该链接的打开方式不是在新窗口中打开

如何写语句实现在a.html里点击b.html里的超链使得在新窗口中打开呢?

我能想到的思路是捕捉到鼠标移动到超链时状态栏的文字,然后根据这些文字来实现在新窗口中打开该链接。

苦于对javascript不熟悉,希望各位高手能指点一下!

多谢,问题解决立即结帖~



------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> </title>

<script language= "javascript " type= "text/javascript ">
function $()
{
var a=document.getElementById( "ifra ").contentWindow.document.getElementsByTagName( "a ");
for(var i=0;i <a.length;i++)
{
a[i].target= "_blank ";
}
}
</script>
</head>

<body>
<iframe onload=$() src= "test4.asp " name= "ifra " width= "100% " marginwidth= "0 " height= "50% " marginheight= "0 " align= "top " scrolling= "auto "> </iframe>
</body>
</html>
本地的就可以,连接外部的就用外一种比较复杂的办法了

------解决方案--------------------
在b.html页面里的超级链接中,把其属性target设置为_blank就行了,如
<a href= "### " target= "_blank "> ### </a>