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.