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>