A Width Changable Iframe

W

WH

While the whidth of the table can be set as 80%, the size of the iframe can
not be changed once set.

I am looking for a solution which the iframe's width can be set according to
the IE/Firefox/Opera's width. Is that possible?
 
Y

Yann-Erwan Perio

WH said:
I am looking for a solution which the iframe's width can be set according to
the IE/Firefox/Opera's width. Is that possible?

Well, you can grab a reference to the frame element, and change its
style properties - this should work on recent versions (IE5+, Mozilla,
Opera7+).

---
<iframe id="foo" src="http://jibbering.com/faq/"></iframe>
<input type="button" onclick="bar('foo')" value="100%">

<script type="text/javascript">
function bar(frameId) {
var frame;
if(document.getElementById) {
frame=document.getElementById(frameId);
frame.style.width="100%";
frame.style.height="100%";
}
}
</script>
 
T

Thomas 'PointedEars' Lahn

WH said:
While the whidth of the table can be set as 80%, the size of the iframe
can not be changed once set.

It can be changed, both explicitely and implicitely.
I am looking for a solution which the iframe's width can be set according
to the IE/Firefox/Opera's width. Is that possible?

Sure.

<iframe src="..." ... width="80%" height="...">
alternative
</iframe>

The "iframe" element above will always take 80% of the width of
the viewport or its parent element; only in working UAs, of course.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top