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

Window scrolling (clarification)

This is a clarification of a previous message, which was not expressed
very well. I have a set of checkboxes near the bottom of the page and
a function that checks or unchecks all of them. But when the function
runs, the window scrolls to the top of the page.

How can I set my checkboxes but leave the window's scroll position
exactly where it is? Or at least have it scroll to the bottom (where
the checkboxes are).

I've tried using window.scrollTo(), but the window always scrolls to
the top no matter what. It's the same in Navigator and IE.

Here's my code:

function checkAll(whichForm, startIndex, endIndex)
{
for (var j = startIndex; j <= endIndex; j++)
{
document.forms[whichForm].elements[j].checked = true;
}
window.scrollTo(0, 1000);
}

Thanks,

Ethan
Jul 20 '05 #1
2 4528

"Ethan" <el**********@yahoo.com> schreef in bericht
news:55**************************@posting.google.c om...
This is a clarification of a previous message, which was not expressed
very well. I have a set of checkboxes near the bottom of the page and
a function that checks or unchecks all of them. But when the function
runs, the window scrolls to the top of the page.

How can I set my checkboxes but leave the window's scroll position
exactly where it is? Or at least have it scroll to the bottom (where
the checkboxes are).

I've tried using window.scrollTo(), but the window always scrolls to
the top no matter what. It's the same in Navigator and IE.

Here's my code:

function checkAll(whichForm, startIndex, endIndex)
{
for (var j = startIndex; j <= endIndex; j++)
{
document.forms[whichForm].elements[j].checked = true;
}
window.scrollTo(0, 1000);
}

Thanks,

Ethan


Hi,

Can you show how this function is called? I suspect you are using something
like:

<a href="#" onclick="checkAll(blabla)">

If so, add a "return false" to prevent the link to do its actual work

<a href="#" onclick="checkAll(blabla);return false">

Fred
Jul 20 '05 #2
"Fred Serry" <fr***************@planet.nl> wrote in message news:<bd*************@ID-108377.news.dfncis.de>...
"Ethan" <el**********@yahoo.com> schreef in bericht ....
How can I set my checkboxes but leave the window's scroll position
exactly where it is? Or at least have it scroll to the bottom (where
the checkboxes are).

I've tried using window.scrollTo(), but the window always scrolls to
the top no matter what.

.... Hi,

Can you show how this function is called? I suspect you are using something
like:

<a href="#" onclick="checkAll(blabla)">

If so, add a "return false" to prevent the link to do its actual work

<a href="#" onclick="checkAll(blabla);return false">

Fred


That's the answer. Thank you very much.

Ethan
Jul 20 '05 #3

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

Similar topics

2
by: yootzee | last post by:
Greetings all, I'm having a problem with scrolling vertically in a newly created browser window. The vertical scrolling is to reach some anchor point within the new browser window. I'm...
3
by: spencer | last post by:
Hello, I have an index page with an autoscroller writen with CSS. The problem is the scrolling content(text and inages)'s position is correct but will off position when the broswer(IE) window...
5
by: Will Gillen | last post by:
I need to have a "scrolling" text label or textbox at the bottom of my window to show the URL of where a song is being played from. I want the text to scroll on a single line from left to right in...
8
by: makunag | last post by:
Didn't get answer with google and in my regular forum. Came across this site and posting here. Your help will be highly appreciated ! Our application have frames - MainNav, TaskNave and Content....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.