473,396 Members | 2,023 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.

How can I prevent scroll-to-top when manipulating nodes?

I have a form larger than a screen. When some radio buttons or
checkboxes are clicked, I need to change the contents of a
select (menu) box by rebuilding the select node. That method
is necessary because I am using groups, which don't seem to have
a clean way to compose them (like selectnode.options[i] =
new Option(mystring)).

A side effect of rebuilding the node is that the form scrolls
to the top, a really annoying effect I would like to avoid. Is
there any way to do this? I'm writing only for NN 7.2.
Jul 23 '05 #1
3 2067
On Thu, 30 Sep 2004 03:23:34 GMT, Richard Trahan <rt*****@optonline.net>
wrote:

[snip]
A side effect of rebuilding the node is that the form scrolls
to the top, a really annoying effect I would like to avoid. Is
there any way to do this? I'm writing only for NN 7.2.


Code? URL?

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
Michael Winter wrote:
(snip)

Mike


Thank you for responding.

Here's some code:

function construct_graph_selection_node()
{
var all = graphset.all; // speed access
var newselnode =
document.forms["formgraphs"]["selectgraphs"].cloneNode(false);
// This will replace the current select node
var nodeforoptions = newselnode; // where the next option (graph) will go
for(var i=0;i<all.length;++i) {
var typ = typeof(all[i]);
switch(typ) {
case "object": // an option (of type Graph)
// options always become children of the current node
var newopt = document.createElement("option");
newopt.setAttribute("value",all[i].getName());
var txt = document.createTextNode(all[i].getName());
newopt.appendChild(txt); // won't display without this
nodeforoptions.appendChild(newopt); // add option to the
appropriate node
break;
case "string":
var newopt = document.createElement("optgroup");
newopt.setAttribute("label",all[i]);
newselnode.appendChild(newopt); // groups are always added to the
selection node
odeforoptions = newopt; // but the next option goes here
break;
}
}
var fnode = document.formgraphs;
fnode.replaceChild(newselnode,fnode.selectgraphs);
}

The culprit is the replaceChild call, which causes a scroll to top.
Jul 23 '05 #3
On Fri, 01 Oct 2004 05:52:08 GMT, Richard Trahan <rt*****@optonline.net>
wrote:

[snip]
var fnode = document.formgraphs;
fnode.replaceChild(newselnode,fnode.selectgraphs);
}

The culprit is the replaceChild call, which causes a scroll to top.


So if you commented-out that call, there's no scrolling?

I assume it's not something daft like you're calling the function from a
link but forgot to cancel the event.

My only thoughts at the moment is that replaceChild removes the targeted
node before adding the new one. This might cause the document to shrink in
size and scroll upwards.

Maybe someone else will have a better idea.

Good luck,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4

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

Similar topics

5
by: pv_kannan | last post by:
Hello, I am stuck with a problem trying to mimic the behavior of a Windows Forms Readonly textbox in HMTL/ASP.NET. Basically, I would like the text to be readonly and overflow the textbox...
7
by: anna | last post by:
Is it possible to have a javascript function which can scroll a page to the far right when a link is clicked? Any code examples available? TIA, Anna
7
by: veronique rossi | last post by:
Hello, I have put a table in a scrollable DIV so that only one part of the table is visible. Now, I want that, when I scroll, the table is scrolled item by item in the table (as it is done when...
8
by: ergobob | last post by:
Hello, I have two scroll boxes on the same page. The first scroll box is good in IE but the words will not wrap correctly in Firefox. The second scroll box is good in all browsers. You can...
1
by: nicholas | last post by:
Hi, If on an asp.net page the user has just selected a value in a dropdownlist and scrolls with the wheel of his mouse, the selected value of the dropdownlist will change. How could I avoid...
2
by: Chris Calzaretta | last post by:
How would I go about getting windows display size for the scroll bar in all windows? Is it in the registery?? Thanks Chris
1
by: jadeite100 | last post by:
Hi: I have an pop-up window with an Iframe that has a text box with scrolldown. The scrolldown in the popup-window does not work but the scroll-down for the iFrame works. The strange thing is I...
7
pentahari
by: pentahari | last post by:
I am add the mouse scroll bar Add-Ins for enable mouse scroll in Visualbasic 6.0 IDE. its work fine. but i want work the mouse scroll in form at runtime. Thanks Advance.
1
by: newbie009 | last post by:
How can I disable horizontal scroll in textbox for FireFox? Right now 1 textbox has vertical scroll and other textbox has horizontal scroll. It only looks like this on FireFox but it looks ugly....
1
by: qfchen | last post by:
I can find "Horizontal Scroll Bar" control in ToolBox, but I can't find the "Scroll Bar" like used in Sound Volume Control. Where should I get this kind of scroll bar? Thanks
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.