
Код:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<table id="chElem" bgcolor="#00ffff" height="100" width="100">
<tr>
<td>qwqeq qweqwer</td>
</tr>
</table>
<script language="JavaScript">
function changeEl()
{
//alert(document.documentElement.firstChild.nextSibling.tagName);
var myEl = document.documentElement.firstChild.nextSibling;
var remEl = myEl.removeChild(document.documentElement.firstChild.nextSibling.firstChild);
var newElem;
newElem = document.createElement("IMG");
newElem.setAttribute("src", "myImage.jpg");
document.body.appendChild(newElem);
return false;
}
</script>
<a href="#" onclick="return changeEl()">asd</a>
</body>
</html>
Вот так.
Люди, кто знает, можно ли добраться до элемента, который надо убить, более простым путем -- чтобы не проходить каждый раз по всему дереву???