/    Sign up×
Community /Pin to ProfileBookmark

How to "jump" to a particular section of a page?

OK. I have a very large page that loads.

First there images, then at the end, is an Index.

I want to add an Onload=”something” to jump to Index.

I’ve tried adding in a

[CODE]<input type=”hidden” name=”test” value=””>[/CODE]

and using document.test.focus(); but that errored out.

Using the same above concept, I tried placing a

[CODE]<DIV>[/CODE]

but again get an error (not an object or null).

Thanks
George

to post a comment
HTML

6 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJul 20.2006 — link to the page and add [I]#test[/I] at the end (name of that hidden field, but the best would be to name that "index", whatever it is and place the name in the url)
Copy linkTweet thisAlerts:
@ggallenauthorJul 20.2006 — I don't want to change the URL. Also, I may have some other instances using javascript where I will want to move the page to that location.

problem is there are no "input" fields to focus() on.

I've setup the #... before for when I want to click on it, but how

would I do it automatically, without click intervention?
Copy linkTweet thisAlerts:
@ggallenauthorJul 20.2006 — Well, using focus() doesn't seem to be the way to go, since my page

has no input boxes, there are no objects that can hold a focus().

I can't use the URL # method, since this is a dynamically created HTML

page, and I may need to jump to different sections each time, thus

the reason for wanting to place it in the Body OnLoad=""; section.

Still looking for a method to jump to "display" from a section of the page.

Is there something else besides focus() I can use if I don't have any

input objects?

George
Copy linkTweet thisAlerts:
@skilled1Jul 20.2006 — <a href="#href">link to your index</a>

<a name="href"></a> place this before your index code


i am not to sure about an on.load event, if i went to a page, and it made me jump to the bottom for no reason that would frusterate me
Copy linkTweet thisAlerts:
@ggallenauthorJul 20.2006 — I'm using the anchors from within the Index to jump backwards. That works

fine.

The index is like a table of contents, except for layout reasons, there

can't be anything in front of (top of) the body., so when the page

loads, which is a very large page, could have 200 or so images, so

getting to the index would take quite a lot of scrolling ?

The page is mostly not to be viewed, but rather to be printed, but the

"preview" screen, jumps to the index in case you want to view a particular

image, otherwise, once the screen has been previewed, a bunch of

DIVS get hidden, then the page gets sent to a printer file.

Just for testing, I placed a small input text box at the index, however, when

the onload() function does the focus(), the textbox is at the bottom of the

screen, and not the top, not sure if there is any way to get around that one.

hmmm. I wonder if I can use window.location and put in the anchor position?

I'll have to give that a try now.
Copy linkTweet thisAlerts:
@ggallenauthorJul 20.2006 — Success.

in the [CODE]<body OnLoad="window.location='#anchorname';">
.
.
.
<a name="anchorname"></a>
.
.
[/CODE]


And it puts it at the top of the page.
×

Success!

Help @ggallen spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...