Forum Moderators: open
the script didnt work at all in explorer 6 or 7, and found that this line was causing the problem. Does explorer not understand the insertBefore(element) at all?
Is there a way round it without re-writing the entire script?
Thanks
:)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title>Untitled</title>
</head>
<body>
<span id="target"><< That was inserted before this!</span>
<script type="text/javascript">
window.onload = function () {
var target = document.getElementById('target');
var parent = target.parentNode;
var newNode = document.createElement('span');
newNode.appendChild(document.createTextNode('Hi there!'));
parent.insertBefore(newNode, target);
};
</script>
</body>
</html>