Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/09/2008, 02:27
Avatar de ZiTAL
ZiTAL
 
Fecha de Ingreso: marzo-2004
Ubicación: Bermio (Bizkaia)
Mensajes: 1.545
Antigüedad: 21 años
Puntos: 62
De acuerdo Respuesta: Guardar el contenido de body en una variable

Javascript:

Código:
function modal()
{
	var body = document.getElementsByTagName('body')[0];
	var bodyContent = getContent(body);
	removeAllChilds(body);
	insertContent(body,bodyContent);
}
function getContent(a)
{
	var aContent = new Array;
	for(var i=0;i<a.childNodes.length;i++)
	{
		aContent[i] = a.childNodes[i];
	}
	return aContent;
}
function removeAllChilds(a)
{
	while(a.hasChildNodes())
		a.removeChild(a.firstChild);
}
function insertContent(a,content)
{
	for(var i=0;i<content.length;i++)
	{
		a.appendChild(content[i]);
	}
}
HTML:
Código HTML:
<html>
    <head>
        <title>Modal</title>
		<script type="text/javascript" src="js/modal.js"></script>
    </head>
    <body>
        <div id="aaad">
            asdasd
        </div>
		<a href="#" onclick="modal()">prueba</a>
    </body>
</html> 
__________________
http://zital.no-ip.org
____________________

Euskerie ahuen eta bijotzan