jobo: replaceChild

Beitrag lesen

Hallo,

um nur replace zu testen, würde ich auf den rest verzichten.

  
<html>  
	<script>  
	myReplace = function() {  
		p1 = document.getElementById("p1");  
		p2 = document.getElementById("p2");  
		document.getElementsByTagName("body")[0].replaceChild(p1,p2);  
	}  
	</script>  
	</head>  
	<body>  
	<p id="p0">p0</p>  
	<p id="p1">p1</p>  
	<p id="p2">p2</p>  
	<p id="p3">p3</p>  
	<button onclick="myReplace()">myReplace()</button>	  
	</body>  
</html>  

Gruß

jobo