Блин, че за дела? Вот ведь файл:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>JS Testing</title>
<center><h3>Сайт</h3></center>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p id = "id1">текст1 <p>текст2</p> </p>
<script type = 'text/javascript'>
function replaceNodeText(id, newText){
node = document.getElementById(id);
while (node.lastChild){
node.removeChild(node.lastChild);
}
node.appendChild(document.createTextNode(newText));
}
replaceNodeText("id1", "ololo");
function removeChildren(id) {
node = document.getElementById(id);
var children = node.childNodes;
for(var i=0;i<children.length; i++) {
var child = children[i];
node.removeChild(child);
}
}
//removeChildren("id1");
</script>
</body>
</html>