Dear all, I am working on a VB project on ASP .Net using Visual Studio. I need to set some bookmark on a Web page such that when user click on the bookmark, he can reach the desired location in the Web page. As my Web page is long, this will facilitate the
user to navigate the Web page. As I am a beginner on this, now I can just make a bookmark such that user can go to the top of the Web page. I have no idea on how to make bookmark so that he can go to other locations, e.g. the bottom. There is another defect
of my "top" bookmark. When user click the "top" bookmark, the screen will flash twice. Here are details of my codes : In the VB Code behind, in "Page_Load" function, btnTop.Attributes("onClick") = "javascript:location.hash='#top';' The "btnTop" is a button.
The codes work. But as I mentioned before, the screen flashes twice as user click this "btnTop" button. Also I do not know how to make other bookmarks to other locations on the Web page. Thanks in advance. W.M. Chung (email : wmchung@mtr.com.hk)
The actual term (in html anyway) is an anchor. it is positioned on the page where ever you want it. in the HTML part of the page. go to where you want the anchor and insert the following:
When you want to link to this simply set the link as:
Link Text or from code i think you would require the page name as in: response.redirect("yourpage.aspx#your_anchor_name") assuming you use the response.redirect method. tell me if this works. or if you need more help simply
post back here David Legg
Dear David Legg, Thanks very much. I have tried your way. But I still have one problem that I cannot specify the location of the anchor. e.g. in the HTML editor in Visual Studio, I add the lines :
RN3When clicking the link "RN3" in the Web page, it can go to the top of the page. But actually I need to move to the middle of the page. So when I change the second line to :
The link "RN3" does not work. The Web page just does not move. Do you have any idea ? Thanks. W.M. Chung
try placing the anchor in the required position in the code because i do not think that you can have an absolutely positioned anchor. try that. David Legg
I have tried using relative positioning by specifying POSITION as relative, TOP as 400px. It still brings me to the top of Web Page. I have tried to move the html code to different locations, it still does not work. It just brings me to the top of Web Page.
Most of my other controls are asp controls with absolute positioning. Does this matter ? Thanks. W.M. Chung
have you tried doing it with no positioning information in the tag? try placing it in the middle of the text on the page with NO POSITIONING INFORMATION in it. the link should take it to the lace of the anchor in the code David Legg
Yes. I have tried to do it with no positioning information. Let me show the detail coding :
Link"Label_a" is where I want to go. Clicking "Link" just brings me to the top of page, instead of "Label_a". Is there other way, instead of using anchor, to do such thing ? Thanks. W.M. Chung
As far as i know that is the only way of doing it. could you send all your code (preferably in the aspx file) to me at daverlegg@aol.com and ill take a look because i tried the method on my pc and it worked fine. so if you send it to me i may be able to fix
it for you David Legg
Thanks for sending the source. I have worked out how to do it. place the
tag within the label tag as such: your text This is because the anchor can not be placed using a style tag and so defaults to the top of the page. placing it inside the lable tag forces it to be in the position of the label. Hope this
helps tell me if it doesn't David Legg
wmchung
Member
25 Points
5 Posts
Bookmarks in a Web page
Aug 04, 2003 09:05 AM|LINK
imleggy
Contributor
2680 Points
536 Posts
Re: Bookmarks in a Web page
Aug 04, 2003 05:55 PM|LINK
wmchung
Member
25 Points
5 Posts
Re: Bookmarks in a Web page
Aug 05, 2003 02:58 AM|LINK
imleggy
Contributor
2680 Points
536 Posts
Re: Bookmarks in a Web page
Aug 05, 2003 08:01 AM|LINK
wmchung
Member
25 Points
5 Posts
Re: Bookmarks in a Web page
Aug 06, 2003 08:07 AM|LINK
imleggy
Contributor
2680 Points
536 Posts
Re: Bookmarks in a Web page
Aug 06, 2003 08:30 AM|LINK
wmchung
Member
25 Points
5 Posts
Re: Bookmarks in a Web page
Aug 06, 2003 08:55 AM|LINK
imleggy
Contributor
2680 Points
536 Posts
Re: Bookmarks in a Web page
Aug 06, 2003 10:00 AM|LINK
imleggy
Contributor
2680 Points
536 Posts
Re: Bookmarks in a Web page
Aug 07, 2003 09:11 AM|LINK