在不使用JavaScript的情况下更改iframe内容时移至页面顶部 [英] move to top of page when changing iframe content without using JavaScript

查看:84
本文介绍了在不使用JavaScript的情况下更改iframe内容时移至页面顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我检查了以下问题:


在iframe中加载远程内容时滚动父页面
但是我想避免使用javascript如果可能的话。
我有一个iframe

I have checked the questions: How do I Scroll parent page to top when child page is click within iframe? and Scrolling parent page when remote content loads in iframe But I would like to avoid javascript if possible. I have an iframe

<iframe name="MapFrame" id="MapFrameID" src="http://maps.google.ch/maps?f=q&..."></iframe>

以及一些指向它的链接:

And some links that point to it:

<a href="http://maps.google.com/maps?q=St%C3%A4mpflistr.+28,+3052+Zollikofen..." target="MapFrame">mostra sulla mappa</a>

我的问题是,一些链接远远低于页面,当它们被点击 iframe不可见或仅部分可见。

My problem is that some of the links are far below in the page and when they are "clicked" the iframe is not visible or only partially visible.

如何强制页面滚动到顶部而不使用javascript?

How can I force the page to scroll to the top without using javascript?

我已经在页面顶部有一个div,id = Fascione,我在页脚中使用去顶部

I already have a div at the top of the page with id=Fascione that I use in my footer to "go to the top"

<a href="#Fascione"><img class="NoBackground" alt="Go to top" src="images/common/go_up_black.png" width="30" height="30"></a>

我想重新使用它;这是可能的(再次没有JavaScript)?

and I would like to re-use it; is this possible (again without javascript)?

推荐答案

您可能想要尝试这段代码:

You may want to try this piece of code:

< a href =#Fascioneonclick =parent.scrollTo(0,0);>转至页首< / a>

这是将页面滚动到顶部的简单方法。

This is a easy way to scroll the page to the top.

这篇关于在不使用JavaScript的情况下更改iframe内容时移至页面顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆