473,325 Members | 2,342 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,325 software developers and data experts.

jumping to an achor

is there any way to jump to an anchor on the page load. the thing is I
dont want to reload the page (as the page is being called by a submit
button on a form, so if i call the page again with an anchor tag i
loose all the form details)
someone said that to jump to an anchor with name anchorID you could
use

document.getElementbyID("anchorID").click();

but this method doesnt exist for anchor objects. is there another way
(that works) to do this. ive looked at the anchor object inthe
documentation but dont find any associated methods.

thanks

Niall
Jul 23 '05 #1
2 2328
On 31/8/04 6:13 pm, Niall Linden wrote:
is there any way to jump to an anchor on the page load.


Would it be too much trouble just to add "#anchor" to the URL?

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 23 '05 #2
Niall Linden wrote:
is there any way to jump to an anchor on the page load. the thing is I
dont want to reload the page (as the page is being called by a submit
button on a form, so if i call the page again with an anchor tag i
loose all the form details)

someone said that to jump to an anchor with name anchorID you could
use

document.getElementbyID("anchorID").click();

but this method doesnt exist for anchor objects. is there another way
(that works) to do this. ive looked at the anchor object inthe
documentation but dont find any associated methods.

thanks

Niall


if (document.layers) {
// netscape 4 support
location.replace(location.href + '#anchorname');
} else {
location.hash = '#anchorname';
}

<a name="anchorname"></a>

Be aware, there are browsers other then Netscape 4 that support
document.layers, this solution works for me because I don't have to worry
about my userbase using those other browsers. Also, I've discovered some
odd behaviours with this and Opera 7.54. If I set location.hash twice in a
row to the same value, it reloads the page. I haven't tracked down if this
is a problem with my code, or a bug in Opera.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #3

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

Similar topics

6
by: Steve Lefevre | last post by:
Hey folks -- I have a series of selectboxes on a web form. I would like to have a javascript jump the focus to the next selectbox when the user presses a key. Each box has the values 1 through...
17
by: compassSoftware | last post by:
Hi, I have two horizontal frames, one on top of the other. The top frame is an image map of a street with property boundary's on it. The bottom frame is a table with each row of the table...
2
by: Scott Eade | last post by:
I am using select()/focus() to position the cursor at a particular field on a form. This works, but when the user presses the Tab key in IE the cursor jumps to the address bar rather than the next...
3
by: jalkadir | last post by:
By jump I mean ending unexpectedly. The program below, like the jumping beens, has an unusual behaviour. When the noted lines are not present the program terminates disregarding the rest of the...
2
by: Chris Dunaway | last post by:
I can't believe that this late in the day that no has mentioned yet that VS2005 is now available on MSDN!! I figured there would be shouts ringing though the hills!
10
by: M | last post by:
Hi, Suppose you have the situation where you have say 20 blocks of text (~250 chars each) in a MySQL db that you need to display, but each has a condition to check to see whether you should...
14
by: spamtrap | last post by:
Mostly for testing reasons I'd like to see if it makes sense to chose the following approach for just-in-time compilation of shaders for a renderer: Seeing as the shaders themsefs consist mostly...
3
by: töff | last post by:
On my site http://www.sjcga.com I have a javascript-generated navigation menu in the top right corner. The menu works great in IE and Opera ... but in FireFox, on the 1st click, the menu jumps...
7
by: Chris Lasher | last post by:
Hi all, I have a simple script: --- #!/usr/bin/env python a = 1 b = 2
19
by: Steve | last post by:
Hi there, I'm having a problem with a webpage where hoving over the top navigation links causes my footer to jump up to the centre of the page! It only happens with IE7, and works fine with the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.