Resizing Iframes On Click?
Dec 1, 2009
I run a streaming site and am looking to have the option on a chat room next to the stream. Not everyone likes having the chat facility so I'd like to make it optional.
As the page loads I'd like the content to look like the diagram below with the stream (iframe1) taking up 95% of the page and the other 5% being taken up by an image which will say "open chat". The chat (iframe2) would have a width of 0%. [URL]
Then when the "open chat" image is clicked I'd like the chat (iframe2) to become 35% and the stream (iframe1) to become 60%. If someone could make a nice sliding effect when the image is clicked that'd be even better. Here's a diagram to show what it'd look like with the resized iframes. [URL]
View 1 Replies
ADVERTISEMENT
Jul 23, 2005
Does anyone know of how I could dynamically resize an iframe based on
the content's height (for IE) so that no scrollbar appears for the iframe?
The content will be from a different domain. I have searched on the web and
have seen solution like this
<script>
function resize() {
var oframe = document.getElementById("frameID");
//***
//var odoc = oframe.document; //(1)
var odoc = oframe.Document; //(2)
var obody = odoc.body;
oframe.height = obody.scrollHeight;
}
</script>
The html :
<iframe onload="resize()" src=http://different.comain.content border="0"
....... > </iframe>
I have seen 2 solutions on the web, the only difference being lines (1) and
(2) get substitued.
My browser is version IE 6.
It seems that the solution with line (2) works perfectly when the content is
from the same domain but gets a Permission Error if the domain is different.
When the content is from a different domain solution (1) does not give
Permission error, but instead the scrollHeight is significantly smaller
than the actual content. Even if the content is from the same domain it
still gives the wrong size.
So my question is
1) What is the difference between oframe.document and oframe.Document, why
does it give different results?
2) More importantly, how can I dynamically adjust the iframe size based on
the content height from a different domain?
View 1 Replies
View Related
Jan 28, 2009
I have a PHP page with an iframe where I load PERL/CGI content. Now of course when I click anything on the parent page the iframe refreshes with it.
But what I really want is to have the parent page refresh when anything inside the iframe is clicked. Of course the iframe should not refresh and go to initial view then. So basically I am looking for a way to have ONLY the parent page refresh every time something in the frame is clicked or to have the parent page and the iframe refresh but with the iframe retaining the last user position.
View 4 Replies
View Related
Sep 12, 2005
I believe that different browsers treat frames/iframes differently, and this
is one of the reasons to avoid using them in websites/applications.
Are there any other reasons to avoid them?
In my experience I find them clunky and messy to implement using javascript
and prefer to keep the whole web page as a single page.
View 1 Replies
View Related
Aug 29, 2006
Code:
Currently, I have one of the iframes working. When you click on it text
below appears with information about the jewelry.
I would like an iframe to open up (immediately to the left of the
image) and show an enlarged image of the thumbnail (yes I know right
now the images are not thumbnails, but my friends are working on the
graphics).
View 1 Replies
View Related
Jul 20, 2005
I want to load a javascript file on a root page with various iframes,
then call the javascript functions from the root page to be displayed
in the iframes. Any idea how to do this?
View 2 Replies
View Related
Aug 8, 2007
I have a mainpage and it contains iframe (myFrame). A js function validatedata() is on iframe. before submitting mainform in mainpage i am calling validatedata() function as below. mybool = document.myFrame.validatedata();
This works in IE 6.0 but fails on mozilla firefox.
View 2 Replies
View Related
Jun 20, 2006
I have a webpage with some divs and iframes in them, I have some Javascript code in another page in one of the iframes that when activated, will change the page within the other iframe. The code I have throws the following error:
'null' is null or not an object
and it is complaning abou the following bit of code:
var obj = document.getElementById("frame2");
obj.src = new_src;
But I am not sure if the code is the correct code anyway. Can anyone assist please?
Please find below my complete code, hopefully you can spot what's going on. Here is my 'index.htm' file: Code:
View 2 Replies
View Related
Mar 12, 2002
I'm starting to use some iframes in a div layer. I want to know if i can use javascript to change the size of the iframe (from the parent page containing the iframe).
In IE i can use 100% width and height to fit the iframe to the layer, but in Netscape 6 the iframe doesn't appear if the height is set in % values - hence the need to be able to specify it dynamically as the layer wil change size.
View 1 Replies
View Related
Dec 1, 2005
Is there a way to use Javascript to detect if a browser supports IFrames, or (if it DOES support them)that IFrame use is enabled?
View 3 Replies
View Related
Jan 6, 2006
I am using struts frame work and in one of the jsp pages I have a bunch of IFRAMES like this.(This is in logic iterate and the recordId is incremented with that iteration) ....
View 3 Replies
View Related
Sep 22, 2006
I have a really professional conspiracy movie site
and I use tons of layers and an external scroll bar assembly.
I would like to put the various sections into MS Iframes and
in order to clean up the page but I find that the iframes interfere
with the getting the mouse coords from the screen which is
essential in moving the scroll bar around.
My test html is given below. With the iframe hidden the mouse coords
are obtainable. With the iframe visible things get buggy.
Where the "background_foriframe.html" is just a html file with
a background layer using a "DIV" tag. Code:
View 19 Replies
View Related
Nov 17, 2006
Is there a way to communicate between iframes on different subdomains?
e.g. from one.dot.com to two.dot.com? there is a security access
restriction passing javascript commands between subdomains that we've
run into.
View 8 Replies
View Related
Nov 17, 2011
I have a problem with iframes. In my page there are two iframes, one for loading and one for projects.
Here you can see the problem after clicking on a thumbnail image: [obscured]
My question is: How can I do to hide the second iframeand display it only after the end of loading of first iframe?
I don't have uploaded the code onjsfiddlebecause there doesn't work
View 2 Replies
View Related
Dec 21, 2009
I basically want to input the url from a form & display it in an iframe, but cant figure out how to link the url from the form to the iframe
The code im using atm
<html>
<head>
<title> SearchLite v2 - search multiple sites at once</title>
[code]....
View 3 Replies
View Related
May 9, 2010
Is it possible to add an onclick event to an iframe or perhaps a DIV that holds an iframe?
In specific I am using the Facebook Open Graph like button code...
What I would like to do is add a simple onclick event to it so that I can run a process when the user clicks on it, at the moment I am just trying alert but cannot get it to work. By setting the iframe within a DIV with height/width specs set would an onclick event work within the DIV?
View 1 Replies
View Related
Dec 30, 2010
I apologise if this is in the wrong section. I have built a website using iframes at: [URL] but when clicking through the menu, the address bar still stays at [URL] no matter which page is loaded into the iframe. I have seen a number of javascripts around that can change this, but most do not seem to work anymore. Has anyone a sure way to correct this please :)
View 8 Replies
View Related
Dec 15, 2011
I have both the java script and the php files, i just need to intergrate them into eachother to display the different topics and forums:
New Forum:
index.php :
<?php
include('../includes/db_connect.php');
include('../includes/inc-logincheck.php');
[code]....
View 4 Replies
View Related
May 19, 2005
<pre>
<html>
<head>
<title>Snapitup Script</title>
<style type="text/css">
*{margin:0;padding:0;}
</style>
<script type="text/javascript">
/* script made by gmn17@hotmail.com © 2005 free to use */
/* keep this script credit intact,thanx, a script to show/hide */
/* any html in IE Safari and Firefox, if you wish to preload */
/* just put it in the target, stripped out table and eval */
/* statements from 2 scripts and combined them, then altered */
/* part of a www.shawnolson.net script took eval statement out */
function snapitup(target,statement){
string = 'theTarget = document.getElementById("'+target+'");'
if(theTarget != null){
theTarget.innerHTML = statement;
}
var el=document.getElementById(target);
var theTarget=document.getElementById(target);
if(el.style.display!="none"){
el.style.display="none";
}else{
el.style.display="";
theTarget.innerHTML = statement;
}
}
/* use this to preload content */
function hideShow(target){
theTarget = 'document.getElementById("'+target+'");'
var el=document.getElementById(target);
var theTarget=document.getElementById(target);
if(el.style.display!="none"){
el.style.display="none";
}else{
el.style.display="";
}
}
</script>
</head>
<body>
<a href="#null" onclick="snapitup('row22','<iframe src=http://www.yahoo.com width=100% height=500px frameborder=none style=border:0></iframe>')">Category 1</a><br>
<a href="javascript:void(0);" onclick="hideShow(ཝ')">Category 2</a><br>
<div id="33" width="100%" style="display:none;"><img src="tn_1_books.gif"></div>
<p id="row22" width="100%" style="display:none;"></p>
<a href="javascript:void(0);" onclick="snapitup('row11','<table id=nTable border=2 width=500 height=400 cellpadding=0 cellspacing=0><tr><td>Data One</td><td>Data Two</td><td>Data Three</td><td><a href=# class=button>More</a></td></tr></table>');">Category 3</a><br>
<div id="row11" width="100%" bgcolor="#b9b9b9" style="display:none;position:absolute;left:100px;top:100px;"></div>
</body>
</html>
</pre>
Ok first the bad, it will not work from a stylesheet, you have to use style="display:none" all over the place, I will try to fix that without adding more than 2 lines to the script somehow, I hope. you can not have line breaks in the innerHtml statements in your links(I think that's normal anyway). javascript:void(0); will not work for an iframe, you have to use #(or #null to keep from clicking up to the top of the page) for the hrefs, I don't know if that is a bad thing or not, there has to be something better than both of those options. now the good, if you do not have access to the head of a page, everything works from the body of a page. it is good for making ul/ol tags for a vertical menu without that complicated scripting having to differentiate ul/ol text and li links in those scripts for just a simple menu, the ecmascriptmenu is the only one that makes sense to me, hope he gets his server fixed. the script seems to work with or without a doctype in IE6 firefox and safari. people always wonder why I try to make these type of scripts, I usually maintain long lists of links so I like to provide small previews(iframes that do not load until clicked) for each link, the best part is that IE firefox and safari react to it flawlessly unlike most other types of scripting, one script had an eval statement that gave me tons of trouble taking it out and the other script I took out a server sql proprietary call to a rowid for a table and made almost any html element be a target(a p tag for instance).
here at :
View 9 Replies
View Related
Oct 29, 2004
I have a table that contains two iframes, left and right. The left iframe contains a list of choices, when clicking the selection the right iframe displays the requested data.
Each of these choices link to web pages that are the same width but different heights.
If I right click my home page icon and open the page containing the two iframes in a separate web browser window, everything works correctly as I choose all of my different choices in my left iframe. I am calculating the height of the iframe so that it can be sized vertically.
If I dont right click and open in a new browser but let these two iframes load into an existing iframe called content, this is when the iframe never resizes. If you load into an existing target that has a size, is there not a way to have it resize or do I have to load it again?
On larger pages, I can hold my mouse in the right iframe and drag down which will show me the rest of the content in the iframe.
Since everything works correctly when I open the web page containing the two iframes in a new window, I know I could create a page containing each combination of left and right iframes and then loading them into my content iframe.
However, this defeats the purpose of a muti selection list that is supposed to stay static while the right iframe changes content and size.
View 7 Replies
View Related
Nov 7, 2005
If i have an iframe in a page, with dynamically generated db values. Woudl it be possible to write the values of on click to the parent window ?
View 2 Replies
View Related
Jul 4, 2006
I have bigpage.html that has the text "click" in it. Also, it contains the iframe small.html.
In small.html there is the text "visible"
How do you get it so that when you click on "click", "visible" changes from black(default) to red?
View 1 Replies
View Related
Jun 2, 2010
I am working in IE and FireFox compatibility. In my application we are creating dynamic iframes inside another iframe. I have to access a div inside the iframe. In IE everything is working fine. But in Firefox, I am not able to access the div.
I have tried using:
iframename.divname
iframename.getElementsByName("divname")
iframename.getElementById("divname")
iframename.getElementByTagName("divname") --> This was not throwing any error but the element length was 0.
I have created the iframe using the method
function getIframe(name){
var iframe = document.getElementById(name)
var ifDoc
if(iframe.contentDocument){
alert("1");
ifDoc = iframe.contentDocument
} //NS6+
else if(iframe.contentWindow) {
alert("2");
ifDoc = iframe.contentWindow.document
} //IE
else
{
alert("3");
ifDoc = iframe.document
} //IE5
alert ("value for getIframe is "+ifDoc);
return ifDoc
}
View 7 Replies
View Related
Jan 24, 2011
I have a problem because I don't know nothing about Java Scripts. In the [URL] I have load a page that contains two iframes, the first (left) is the menu and the second (right)is the explanation for each one of the menu tabs. No problem so far. The problem is that I need that the menu tab keeps highlighted while you see the relative information on the right side.
View 5 Replies
View Related
Nov 5, 2011
I am building a webpage built with a column on the left, a header, and a main iframe which is the main content of the page. The content of the main iframe can get to be long, and I want the iframe to resize its height to fit the content. I know javascript can do this. I have seen many live examples of it working online. My problem is when I try and use the code myself (even if I leave the live example pages unchanged, but just save them and run them offline) it doesn't work. That is, the iframes work, the page works, but the iframe doesnt fit it's content.
Now, the page that I'm building is fully offline right now and I don't know if my javascript will work just fine if hosted on a domain and accessed online, but as it is it's not working and I don't know why. As an example here is some code, and the page it was taken from
[Code]...
View 2 Replies
View Related
Apr 18, 2010
My javascript function for changing src of iframe does work in Opera, but it doesnt work in firefox or IE. I tried several ways, and now i have no other way, just ask.
function showMap(srcs, ine, ind, link){
if(document.getElementById(ind).style.display == 'table-row'){
document.getElementById(ind).style.visibility = 'hidden';
[code].....
View 4 Replies
View Related