锚事件的问题,请帮忙!! [英] problem with anchor events, please help!!

查看:45
本文介绍了锚事件的问题,请帮忙!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




当按下

浏览器上的后退或前进按钮时是否会触发事件?当有人在设置好锚点后点击

后退或前进按钮时,我需要触发一个事件。


非常感谢您阅读我的问题!


H

Hi,

Is there an event that fires when the back or forward button on a
browser is pressed? I need an event to fire when someone clicks the
back or forward button after an anchor has been set.

Thanks so much for reading about my problem!

H

推荐答案

李先生,


我的意思是当url哈希值发生变化时,换句话说,当位置对象的哈希值变化时;更具体地说,从前进或后退按钮触发




我将从用户角度详细说明:


您输入一个带锚点的页面,锚点的超链接位于页面顶部

。当你点击超链接时,它跳转到

对应的锚点,锚点哈希出现在你的地址栏中

(即#description)。现在,当您点击几个锚链接时,您开始

来构建历史记录。使用您的浏览器,当您单击后退按钮时,

您将开始跳过您所访问的各种命名锚点

之前。


所以,我的问题是当使用后退和前进按钮在

命名锚点之间导航时,是否有办法触发函数

。 />

我很感谢你的关注李,

H

Hi Lee,

I mean that when the url hash changes, or in other words, when the hash
property of the location object changes; more specifically, triggered
from either the forward or back button.

I will elaborate from a user perspective:

You enter a page with anchors, and the hyperlinks to the anchors are at
the top of the page. When you click on the hyperlink, it jumps to the
corresponding anchor, and the anchor hash appears in your address bar
(ie #description). Now, when you click on a few anchor links you begin
to build a history. Using your browser, when you click the back button,
you will begin jumping around the various named anchors you visited
previously.

And so, my question is whether there is a way to trigger a function
when the back and forward buttons are used to navigate between the
named anchors.

I appreciate your attention Lee,

H


el **** @ gmail.com 在2005年12月30日下午7:45发表以下内容:

请引用您要回复的内容。


如果您想通过groups.google.com发布后续内容,请不要使用

回复链接在文章的底部。点击显示选项在

文章的顶部,然后点击回复。在

文章标题的底部。


< snip>
el****@gmail.com said the following on 12/30/2005 7:45 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don''t use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

<snip>
所以,我的问题是是否有办法触发功能
当后退和前进按钮用于在
命名锚点之间导航时。
And so, my question is whether there is a way to trigger a function
when the back and forward buttons are used to navigate between the
named anchors.




你有无法以编程方式知道我是否点击了

前进/后退按钮。你也不会知道我是否点击了右键并且

选择了前进/后退。


你只能,最低限度地知道我在航行。不是我去的地方,

我来自哪里,也不是我选择去那里。


您可以尝试设置跟踪历史记录的cookie页。但

方法和想法本身就会导致失败。


-

兰迪

comp .lang.javascript常见问题解答 - http://jibbering.com/faq &新闻组每周

Javascript最佳实践 - http://www.JavascriptToolbox .com / bestpractices /



You have no way of programatically knowing whether I clicked the
forward/back buttons or not. Nor will you know if I right clicked and
chose "Forward/Backward".

You can only, minimally, know that I am navigating. Not where I went,
where I came from, nor how I choose to get there.

You could try setting a cookie that tracked the history of the page. But
the approach and idea itself lends to failure.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


嗨兰迪,




好​​吧,让我描述一下我正在努力完成的具体任务,

也许你或其他人可以提供一些明确的限制我已经上涨

反对。


我正在构建一个工具,允许actionscript开发人员使用

浏览器前进和后退按钮来触发事件,方法是使用url

哈希作为区分标识符。使用哈希还允许

用于书签,这样当重新访问或链接flash页面时,最终用户试图共享的实际内容可能是直接

访问过。


我有这个工作: http://www.anticipatechange.com/browserSupport/

使用setAnchor按钮设置url哈希值,然后使用后面和

前进按钮观察我正在谈论的功能。


我的问题是后退和前进事件是由
触发的
来自flash内的setInterval函数,它不断检查

url哈希的差异,因此,当检测到差异时,

会触发一个事件。 />

我希望有一种方法让我在

url哈希值发生变化时触发函数调用,但是如果那是不可能的话,给定p roblem,你可以或者其他任何人,想想解决这个问题吗?


我不喜欢不喜欢不断检查网址,这是一个可怕的工作。


非常感谢你的关注兰迪,


H

Hi Randy,

I apologize for the mistake when replying, are there consequences to
the way I replied?

Well, let me describe the specific task that I''m trying to accomplish,
maybe you, or others, could lend some clarity to the limits I''m up
against.

I''m building a tool that will allow actionscript developers to use the
browsers forward and back button to trigger events by using the url
hash as the distinguishing identifier. Using the hash will also allow
for bookmarking, so that when a flash page is revisited, or linked, the
actual content that the end user is attempting to share may be directly
visited.

I have this working: http://www.anticipatechange.com/browserSupport/

use the setAnchor button to set the url hash, then use the back and
forward button to observe the functionality I''m talking about.

My problem is that the back and forward events are triggered by a
setInterval function from within flash that is continually checking the
url hash for differences, and so, when a difference is detected it
triggers an event.

I was hoping there was a way for me to trigger a function call when the
url hash changes, but if that''s not possible, given the problem, can
you, or anyone else for that matter, think of a solution to this
problem?

I don''t like the idea of having to continually check the url, it is a
terrible work around.

Thanks so much for your attention Randy,

H


这篇关于锚事件的问题,请帮忙!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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