Toby Inkster <us**********@tobyinkster.co.uk> wrote in message news:<pa****************************@tobyinkster.c o.uk>...
Julia Briggs wrote:
Ok, how can I get that to auto-center as an absolute layer?
div.layer {
position: absolute;
left: 50%;
width: 200px;
margin-left: -100px;
}
Randy Webb wrote:
Why rely on a JS dependency when its not needed?
Thought I covered that: "Since this is a JS group, I assume you meant
programmatically..."
Took the meaning of "construct" as signifying "after load" as
otherwise it's simply an HTML-related query. Could be incorrect,
although this:
Ok, how can I get that to auto-center...
....didn't help elucidate the issue. fwiw...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>foo</title>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
}
#container {
position: relative;
width: 600px;
height: 400px;
margin: 40px auto;
border: 3px #000 double;
background: pink;
}
</style>
<script type="text/javascript">
//<![CDATA[
function IFramePopulate(ctr_id, src)
{
var ctr;
if (ctr = document.getElementById(ctr_id))
{
while (ctr.hasChildNodes())
ctr.removeNode(ctr.lastChild);
var ifrm = document.createElement('IFRAME');
ctr.appendChild(ifrm);
ifrm.frameBorder = 0; //optional
ifrm.style.width = '450px';
ifrm.style.height = '300px';
ifrm.style.position = 'absolute';
ifrm.style.left = String((ctr.offsetWidth - ifrm.offsetWidth) * .5)
+ 'px';
ifrm.style.top = String((ctr.offsetHeight - ifrm.offsetHeight) * .5)
+ 'px';
ifrm.src = src;
}
}
//]]>
</script>
</head>
<body>
<div id="container"></div>
<div style="text-align:center;"><a href="#null"
onclick="IFramePopulate('container',
'http://www.google.com')">go</a></div>
</body>
</html>
Yes. I know, it's JS....