...

View Full Version : replacing a table?



Kirl
08-28-2006, 10:42 PM
Is it possible to delete a table and put another one in it's place, in the same document?

vwphillips
08-29-2006, 12:49 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--

function Swap(id1,id2){
var obj1=document.getElementById(id1);
var obj2=document.getElementById(id2);
var t=obj2.removeChild(obj2.getElementsByTagName('TABLE')[0]);
obj1.appendChild(t);
var t=obj1.removeChild(obj1.getElementsByTagName('TABLE')[0]);
obj2.appendChild(t);
}
//-->
</script>
</head>

<body>
<input type="button" name="" value="Swap" onclick="Swap('One','Two');" >

<div id="One" >
<table width="200" border="1">
<tr>
<td>Table 1</td>
</tr>
</table>

</div>
<br>
<br>
<br>
<div id="Two" style="position:absolute;visibility:hidden;" >
<table width="200" border="1">
<tr>
<td>Table 2</td>
</tr>
</table>
</div>
</body>

</html>

Kirl
08-29-2006, 04:45 PM
Awesome, thanks a lot!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum