Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1792 How do you center a layer in IE?

You are here: irt.org | FAQ | DHTML | Q1792 [ previous next ]

To centre a layer called bg call this script onload...

<script language="JavaScript"><!--
function placebg() {
  document.all('bg').style.posLeft = (document.body.clientWidth/2) - (bg.offsetWidth/2);
  document.all('bg').style.posTop = (document.body.clientHeight/2) - (bg.offsetHeight/2);
}
//--></script>

Submitted by Dave

©2018 Martin Webb