473,569 Members | 2,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.opti ons[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 2076
On Thu, 30 Sep 2004 03:23:34 GMT, Richard Trahan <rt*****@optonl ine.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 "]["selectgrap hs"].cloneNode(fals e);
// This will replace the current select node
var nodeforoptions = newselnode; // where the next option (graph) will go
for(var i=0;i<all.lengt h;++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.create Element("option ");
newopt.setAttri bute("value",al l[i].getName());
var txt = document.create TextNode(all[i].getName());
newopt.appendCh ild(txt); // won't display without this
nodeforoptions. appendChild(new opt); // add option to the
appropriate node
break;
case "string":
var newopt = document.create Element("optgro up");
newopt.setAttri bute("label",al l[i]);
newselnode.appe ndChild(newopt) ; // groups are always added to the
selection node
odeforoptions = newopt; // but the next option goes here
break;
}
}
var fnode = document.formgr aphs;
fnode.replaceCh ild(newselnode, fnode.selectgra phs);
}

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*****@optonl ine.net>
wrote:

[snip]
var fnode = document.formgr aphs;
fnode.replaceCh ild(newselnode, fnode.selectgra phs);
}

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
8298
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 (overflow attribute) with the user being able to scroll thru the text using the arrow keys within the textbox. I managed to get the readonly and the...
7
3828
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
1898
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 we scroll in a SELECT box). How can I do that? Can I change the scroll step of the DIV? (to set 1 scroll step = line's height in the table)
8
3763
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 see this on a test page at http://www.usernomics.com/ergonomic-products-accessories5.html . Can anyone see why the words will not wrap correctly in...
1
3322
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 this. So how could I disable the mouse scrolling that dropdownlist. Or how could I disable the mouse-scroll on those pages.
2
2732
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
1918
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 have another html page that is a popup-window and the text box scroll-down for the iFrame works and so does the scroll-down for the outer window. ...
7
2352
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
4343
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. http://jumbofiles.com/example.gif I used this code but it only worked for IE not FireFox: style="overflow: scroll; overflow-y: scroll;...
1
1473
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
7615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.