Re: Putting DIV wrapper around all code in body
- From: VK <schools_ring@xxxxxxxxx>
- Date: Sun, 30 Mar 2008 15:19:10 -0700 (PDT)
On Mar 30, 10:02 pm, andrej.kau...@xxxxxxxxx wrote:
I need to put all body content into wrapper when page is loaded. Via
javascript of course.
Initial DOM
<body>
<div>
<p>Some text</p>
<p>More text</p>
</div>
</body>
Modified DOM with javascript
<body>
<div id="myWrapper">
<div>
<p>Some text</p>
<p>More text</p>
</div>
<div>
</body>
Any idea?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en-US">
<head>
<meta http-equiv="Content-type"
content="text/html; charset=iso-8859-1">
<title>Demo</title>
<script type="text/javascript">
function init() {
var elm = document.createElement('DIV');
elm.innerHTML = document.body.innerHTML;
document.body.innerHTML = '';
document.body.appendChild(elm);
}
window.onload = init;
</script>
</head>
<body>
<p>Page content</p>
</body>
</html>
.
- References:
- Putting DIV wrapper around all code in body
- From: andrej . kaurin
- Putting DIV wrapper around all code in body
- Prev by Date: Re: Putting DIV wrapper around all code in body
- Next by Date: Very strange problem with Class object
- Previous by thread: Re: Putting DIV wrapper around all code in body
- Next by thread: Re: Putting DIV wrapper around all code in body
- Index(es):
Relevant Pages
|