473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

jump to an anchor/bookmark

Rob
Hello all,

I have an anchor in my page like <a name-"phase_two"/>.
When I load my page I call the function body_onload in the onload event of
the body tag. Then I like to jump to this anchor/bookmark based on the value
of an variable.

pseudecode example:

function body_onload(){
if (phase==2){
jump_to_anchor("phase_two");
}

if (phase==3){
jump_to_anchor("phase_three");
}
}

Can this be done and if yes how?

Thanks in advance
Rob
Jul 23 '05 #1
2 6495
Rob wrote:
I have an anchor in my page like <a name-"phase_two"/>.
When I load my page I call the function body_onload in the onload event of
the body tag. Then I like to jump to this anchor/bookmark based on the value
of an variable.

Check the location.hash property:
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/hash.asp>

window.onload=function(evt){
var hashValue="#foo";
if(location.hash!=hashValue)
location.hash=hashValue;
}
HTH
Yep.
Jul 23 '05 #2
Rob
Thank a lot, exactly what I needed

Rob
"Yann-Erwan Perio" <y-*******@em-lyon.com> schreef in bericht
news:41***********************@news.free.fr...
Rob wrote:
I have an anchor in my page like <a name-"phase_two"/>.
When I load my page I call the function body_onload in the onload event of the body tag. Then I like to jump to this anchor/bookmark based on the value of an variable.

Check the location.hash property:

<URL:http://msdn.microsoft.com/workshop/a.../properties/ha
sh.asp>
window.onload=function(evt){
var hashValue="#foo";
if(location.hash!=hashValue)
location.hash=hashValue;
}
HTH
Yep.

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mel | last post by:
i am reading html pages from files, once i read and display the contect, i want to go to the end of that page that could be several 100 lines long. i need a java script to execute after i placed...
7
by: Eric | last post by:
I am certain the answer will be 'NO', but I wanted to ask anyway just incase I have missed something. Everyone knows that one pass data to a page in an anchor tag by using the GET Method: <a...
2
by: Robert Wehofer | last post by:
Hello there! How is it possible to jump to an anchor by using ASP.NET? Is it only possible by using JavaScript Code? If so, how has the JavaScript to look like? Thank you in advance, Robert
16
by: darrel | last post by:
I have an anchor on my page: <a name="monkey"></a> I can easily go to this via a redirect, but is there a way to jump to this on postback? -Darrel
6
by: dark.peony | last post by:
Hi, (--1--) I'm trying to find a way to jump to a link (<a href="ref"></a>) in a page that is generated with javascript. The source view of the page only shows the javascript methods. The...
5
by: Randy Webb | last post by:
The list below has the current section number, proposed anchor name, and then the current title of that section. Some make sense, some don't. There are a few that don't have proposed anchor names...
3
by: Bjorn Nordbo | last post by:
Hello, I have a page with a vertical list of photos separated with bits of text. Using page down to view the photos is a bit annoying as it will typically cut the photos as it only jumps a...
12
by: paludi | last post by:
Hello, I am using Access 2002. I created a database where names are stored. Now I want to add a drop down menu which contains the alphabet, means A, B, C... Y, Z. By selecting H for example, the...
2
by: gvrajkumar | last post by:
Hi We are developing an Ajax based application. In this application the URL is fixed and as user navigates on the application we will change Anchor on the URL so that user can bookmark the url...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.