473,287 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

FireFox/NS experts: <iframe> inside <div> question -- help pls!

How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?
Jul 23 '05 #1
9 3102
Julia Briggs wrote:
How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?


Does this work for you?

<style type="text/css">
..inline {
background-color: #FFAABB;
text-align: center;
height: 520px;
width: 520px;
}
..if1{
width: 500px;
height: 500px;
}
</style>
<div class="inline">
<iframe class="if1" SRC="http://www.google.com">
</iframe>
</div>
Jul 23 '05 #2
mscir <ms***@access4less.net> wrote in message news:<10************@corp.supernews.com>...
Julia Briggs wrote:
How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?


Does this work for you?

<style type="text/css">
.inline {
background-color: #FFAABB;
text-align: center;
height: 520px;
width: 520px;
}
.if1{
width: 500px;
height: 500px;
}
</style>
<div class="inline">
<iframe class="if1" SRC="http://www.google.com">
</iframe>
</div>


Since this is a JS group, I assume you meant programmatically...

<!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 {
width: 70%;
height: 70%;
margin: 40px auto;
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');
//ifrm.frameBorder = 0; //optional
ifrm.style.width = String(ctr.offsetWidth + 'px');
ifrm.style.height = String(ctr.offsetHeight + 'px');
ctr.appendChild(ifrm);
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>
Jul 23 '05 #3
RobB wrote:
mscir <ms***@access4less.net> wrote in message news:<10************@corp.supernews.com>...
Julia Briggs wrote:

How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?


Does this work for you?

<style type="text/css">
.inline {
background-color: #FFAABB;
text-align: center;
height: 520px;
width: 520px;
}
.if1{
width: 500px;
height: 500px;
}
</style>
<div class="inline">
<iframe class="if1" SRC="http://www.google.com">
</iframe>
</div>

Since this is a JS group, I assume you meant programmatically...


Why rely on a JS dependency when its not needed?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #4
Ok, how can I get that to auto-center as an absolute layer? I've tried
different ways, but can only get it to display in a fixed position.

Julia
Jul 23 '05 #5
Julia Briggs wrote:
Ok, how can I get that to auto-center as an absolute layer? I've tried
different ways, but can only get it to display in a fixed position.


If you mean how can you center the div on the page using CSS, while this
might not be the best newsgroup for a CSS inquiry, did you try:

margin: auto;

maybe something like:

..div1{
width: 420px;
height: 420px;
margin: auto; /* center div on page */
text-align: center; /* center iframe in div */
}

<div class='div1'>
<iframe>
</iframe>
</div>
Jul 23 '05 #6
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;
}

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #7
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....
Jul 23 '05 #8
RobB wrote:
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..."


Does that mean if they ask how to set the color of an element, in a JS
group, then you will give them a JS solution instead of an HTML/CSS
solution?

Just because a question is asked in a particular group does not mean
that the answer is necessarily the topic of that group.

But this message is not posted solely to c.l.j, it is also posted to
alt.html

Again, why rely on a JS dependency when its not needed?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #9
Randy Webb <Hi************@aol.com> wrote in message news:<B_********************@comcast.com>...
RobB wrote:
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..."


Does that mean if they ask how to set the color of an element, in a JS
group, then you will give them a JS solution instead of an HTML/CSS
solution?

Just because a question is asked in a particular group does not mean
that the answer is necessarily the topic of that group.

But this message is not posted solely to c.l.j, it is also posted to
alt.html

Again, why rely on a JS dependency when its not needed?


This is silly. Here's the original Q:
How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?
When I read that, it seemed unlikely that anyone would be asking if
they could 'construct' an iframe (HTML) inside a div (HTML) - that's
like posting "can I put a image inside a paragraph?" Not impossible,
but unlikely. I interpreted it as a request for a dynamic solution.
But, you're right, I am deeply ashamed, and I'll never post here again
after this unforgiveable lapse.
Does that mean if they ask how to set the color of an element, in a JS
group, then you will give them a JS solution instead of an HTML/CSS
solution?


Maybe. :D
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to...
3
by: tungchau81 | last post by:
Hi, A Modal Dialog does not allow us to highlight the text content inside <DIV> tag unless I use a <textarea> tag to display that text content. However, the situation of my software makes it...
11
by: Jacques | last post by:
I have been writing html/xhtml for nearly as long as I can remember. I do not like frames and stopped using <frameset> a long time ago. But... I have never used <iframe> for anything--never paid...
4
by: sam | last post by:
Hi all, When I use the HTML tidy tool in Firefox I see the following warning which I want to get rid of . I cleared all the errors and warnings it showed except for this one. I am not able to...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.