开发者

What is the syntax that creates a hyperlink to the xy position of a div?

What I'm trying to do is to create a link on the same page to a java applet link for which I don't have 开发者_如何学Cthe parameters. Take a look at any of the chessboards at Chesscalisthenics.com


There's no "link" to xy positions, but from Javascript you could use window.scrollTo.


This is not supported directly in HTML. There is a workaround: Add the xy position as a query parameter to the URL (like ...?x=...&y=...) and add an inClick handler to the link. The handler can examine the URL (this.href) to get the position.


Strictly speaking, you can't. But you can fake it - add the x,y as GET variables in the URL query string, like this:

http://yoursite.com/yourpage.htm?x=50&y=50&target=divID

In your javascript, you'd use something like window.scrollTo to jump to those coordinates, which you can pull from the query string.

Make sense?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜