ASP.NET实现锚无回传 [英] ASP.NET implement anchor without postback
问题描述
我工作在VS2010,C#一个ASP.NET Web应用程序,我要让这样的页面:
I'm working on an ASP.NET web app in VS2010,C#, I want to make something like this page:
http://www.just-eat.co.uk/restaurants-simplyscrumptious/menu
当你点击左侧食品类别,页面跳转到该类别没有任何回传,我怎么能实现呢?
when you click on food categories on left, page jumps to that category without any postback, how can I achieve it?
推荐答案
您使用的锚#
在同一页面URL的末尾与您一起移动的名称下面。
How to move with out post back
You use the anchor #
at the end of the same page url following with the name that you with to move.
然后在页面内放置的名字,你想跳像
Then inside the page you place an anhro with the name that you wish to jump like
<a name="MovePosition"></a>
所以,如果你喜欢做一个链接 http://www.site.com/catalog.aspx#MovePosition
浏览器将濒临与<$ C $行C>&LT; A NAME =MovePosition&GT;&LT; / A&GT; 顶部
参考: http://www.w3.org/MarkUp/ 1995年归档/片/ A.html
如果您还注意到左边的类别是停留在相同的位置。这可以通过许多方式来完成。在这种特定的页面是使用脚本来改变他的位置。如何过更好的是将一个div里面的类别,并在此DIV给这个额外的样式的位置是:固定;底部:0像素;
,并贴在你有位置把它相对于他的父母DIV。
If you also notice the categories on the left are stay on the same position. This can be done by many ways. In this specific page is use a script to change his location. How ever the better is to place the categories inside a div and give on this div this extra style position:fixed;bottom:0px;
and will stick on the position that you have place it relative to his parent div.
有很多方法来保持类别菜单停留在同一个点。另外一个可以在这里找到: http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm 即使这样也老code。
There are many ways to keep the category menu stay on the same point. One other can be found here : http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm even so is old code.
这篇关于ASP.NET实现锚无回传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!