Graham Charles wrote:
I'm trying to move a DIV element to before one of its siblings using a
javascript function.
This works fine on most browsers:
function putdivbefore(divtomove, divtarget)
{
var mydiv1 = document.getElementById(divtarget);
var mydiv2 = document.getElementById(divtomove);
mydiv1.parentNode.insertBefore(mydiv2, mydiv1);
}
On IE, however, it gives spotty results. In a simple test page it
works fine, but when the page is more complex, it causes the browser
to stop loading the page and return "Operation was aborted."
What do you mean by "stop loading"? Are you saying that you are trying
to modify the document tree while the document is still loading? Weird
behavior would not be surprising then.
If yes, which would explain why it works with short/simple documents (they
load fast enough and have less to be parsed), wait until the `load' event
of the document occurs before you modify the document tree.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>