Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 09:49 AM
Ethan
Guest
 
Posts: n/a
Default Adjust window's scroll position depending on which link clicked

I have a form that contains sets of checkboxes. Each set has links
above it marked "Check all" and "Uncheck all". The links call
JavaScript functions.

Here's the problem. When you click "Check all" and it's near the
bottom of the page, the page is RELOADED and the user winds up looking
at the top of the page. Sure, all the boxes are properly checked, but
now the user has to scroll back down to where they were before.

It's easy enough to use the window.scrollTo() function, but because of
setting the checkboxes the document is reloaded, so the scrollTo()
function is useless. It scrolls down, but when the document is
reloaded, it instantly pops back up to the top.

Any solutions?

Thanks,

Ethan
  #2  
Old July 20th, 2005, 09:49 AM
Evertjan.
Guest
 
Posts: n/a
Default Re: Adjust window's scroll position depending on which link clicked

Ethan wrote on 02 jul 2003 in comp.lang.javascript:
[color=blue]
> I have a form that contains sets of checkboxes. Each set has links
> above it marked "Check all" and "Uncheck all". The links call
> JavaScript functions.
>
> Here's the problem. When you click "Check all" and it's near the
> bottom of the page, the page is RELOADED and the user winds up looking
> at the top of the page. Sure, all the boxes are properly checked, but
> now the user has to scroll back down to where they were before.
>[/color]

Why should the page reload, [exept if you submit a form] ?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
  #3  
Old July 20th, 2005, 09:50 AM
Richard Cornford
Guest
 
Posts: n/a
Default Re: Adjust window's scroll position depending on which link clicked

"Ethan" <elektrophyte@yahoo.com> wrote in message
news:55447041.0307021119.53fe8e1d@posting.google.c om...
<snip>[color=blue]
>Here's the problem. When you click "Check all" and it's near
>the bottom of the page, the page is RELOADED and the user
>winds up looking at the top of the page. Sure, all the boxes
>are properly checked, but now the user has to scroll back down
>to where they were before.[/color]
<snip>

Return false from the onclick code to cancel the navigation specified in
the HREF.

Richard.

--

Example JavaScript DOM listings for: Opera 7.11,
Mozilla 1.2 and ICEbrowser 5.4
<URL: http://www.litotes.demon.co.uk/dom_root.html >


  #4  
Old July 20th, 2005, 09:50 AM
Ethan
Guest
 
Posts: n/a
Default Re: Adjust window's scroll position depending on which link clicked

"Richard Cornford" <Richard@litotes.demon.co.uk> wrote in message news:<bdvj5q$t0r$1$8300dec7@news.demon.co.uk>...[color=blue]
> "Ethan" <elektrophyte@yahoo.com> wrote in message
> news:55447041.0307021119.53fe8e1d@posting.google.c om...
> <snip>[color=green]
> >Here's the problem. When you click "Check all" and it's near
> >the bottom of the page, the page is RELOADED and the user
> >winds up looking at the top of the page. Sure, all the boxes
> >are properly checked, but now the user has to scroll back down
> >to where they were before.[/color]
> <snip>
>
> Return false from the onclick code to cancel the navigation specified in
> the HREF.
>
> Richard.[/color]

That solved the problem thanks.

I made a mistake before -- the page is not reloaded. It just scrolled to the top.

For the record, here's the way to set it up so that it works right...

<a href="#" onclick="uncheckAll(0, 68, 75); return false;">

Ethan
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles