Javascript 如何制作a href="#top";从iframe到父窗口

Javascript 如何制作a href="#top";从iframe到父窗口,javascript,html,Javascript,Html,我正在使用父窗口和一个iframe,下面给出了我的html代码 Page1.html <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page

我正在使用父窗口和一个iframe,下面给出了我的html代码

Page1.html

    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    </head>
    <body>

    <a name="logo"  href="Page2.html">dsd</a><br/>
ttttttbr/>
rrrrr<br/>
rrrrr<br/>
rrrrr<br/>
rrrrr<br/>
rrrrr<br/>
rrrrr<br/>
<iframe name="I1" src="Page3.html">Your browser does not support inline frames or is currently configured not to display inline frames.
    </iframe>

    </body>

    </html>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>

<a href="Page2.html?#logo">dsd</a><br/>
</body>

</html>

新的第1页

TTTTBR/> rrrrr
rrrrr
rrrrr
rrrrr
rrrrr
rrrrr
您的浏览器不支持内嵌框架,或者当前配置为不显示内嵌框架。
Page3.html

    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    </head>
    <body>

    <a name="logo"  href="Page2.html">dsd</a><br/>
ttttttbr/>
rrrrr<br/>
rrrrr<br/>
rrrrr<br/>
rrrrr<br/>
rrrrr<br/>
rrrrr<br/>
<iframe name="I1" src="Page3.html">Your browser does not support inline frames or is currently configured not to display inline frames.
    </iframe>

    </body>

    </html>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>

<a href="Page2.html?#logo">dsd</a><br/>
</body>

</html>

新的第1页

如果我单击side iframe中的链接,请在side iframe中打开page2.html并一起移动到父窗口页面的顶部

我怎么能做到

希望你的支持


Alex

我认为这不能用纯HTML来完成。为此,您需要JavaScript,如下所示:

<a href="Page2.html" onclick="parent.location.href='#'">

我认为这不能用纯HTML来完成。为此,您需要JavaScript,如下所示:

<a href="Page2.html" onclick="parent.location.href='#'">

我尝试这样做,但它是用page 2.html打开的,它不会移动到父窗口的顶部。我尝试这样做,但它是用page 2.html打开的,它不会移动到父窗口的顶部