Resizing The Width Of Inline Frames
Mar 19, 2005
I did some searching on here and came across a nice example of how to resize an iframe's height using javascript. I've been screwing with it for hours now but I can't seem to get it working for resizing the width. I can't seem to figure out what I'm doing wrong. Here is the code:
function getIFrameDocumentWidth (IFrameDoc)
{
if (typeof IFrameDoc.width != 'undefined') newWidth = IFrameDoc.width;
else {
if (IFrameDoc.body && typeof IFrameDoc.body.scrollWidth != 'undefined') newWidth = IFrameDoc.body.scrollWidth;
else newWidth = null;
}
return newWidth;
}
function resizeIFrameWidth (iframeID, minWidth)
{
var IFrameDoc, oIframe = document.getElementById(iframeID);
if (typeof oIframe != null)
{
if (oIframe.contentDocument)
IFrameDoc = oIframe.contentDocument;
else if (oIframe.contentWindow)
IFrameDoc = oIframe.contentWindow.document;
else if (oIframe.document)
IFrameDoc = oIframe.document;
var newWidth = getIFrameDocumentWidth (IFrameDoc);
if (newWidth != null) oIframe.style.width = String(newWidth + 'px');
else oIframe.style.width = String(minWidth + 'px');
}
}
Then in the html page whre the iframe sits I use:
Code:
<body onload="parent.resizeIFrameWidth('myFrame', 250)">
Any ideas why this might not be working?
View 5 Replies
ADVERTISEMENT
May 18, 2010
I've recently start using Flexigrid (old JQuery grid plugin), and, as you may know, one of the few issue this really good grid plugin got is the lack of liquid layout option. My personal idea to solve the problem is to set the "width" parameter depending on $(window).width. Here is the problem (and here's why i post this question in "General use" and not in "Plugin").
The starting, and working, code is:
$(document).ready(function(){
$("#flex1").flexigrid
(
{
[Code].....
This work fine for me, but I supose it could be done way much elegant... maybe somethin without "IF" that could emulate the "%", like var percentage = $(#div.id).width()*0.XX with the 0.XX picked from an array of percentage, one for each column. Probably I should set up a function... ahhhh, as you may easily see I'm a total beginner with JQuery (and JS in general...)
View 3 Replies
View Related
Sep 22, 2005
I apologize if this is not the right group for this, but I saw some
other messages on this topic in here, so thought I'd take a shot in the
dark...
I am running IE 6, XP, SP2. When I connect to certain sites that use
inline frames, I get the message 'Your browser does not support inline
frames or is currently configured not to display inline frames.'
The aggravating thing is I recently bought multiple Dell computers,
have 2 in the room with me right now, haven't touched a thing
browser-wise on either, and it works fine on 1 and not the other. Same
OS, same IE version, etc.
View 2 Replies
View Related
Sep 25, 2003
I'm building a tool for my company and I'm making use of frames in it. I have one frame on the left side and two frames on the right side. I have two forms on the main frame (the left panel) and the user has an option to submit to either frame or to both frames.
I'm wondering: is there any way to resize the right bottom or right top frame via JavaScript if someone submits to only one of the frames?
View 2 Replies
View Related
Sep 19, 2010
The *small, medium fullsize* text will be off to the left (in IE8 or IE9, works fine in Chrome, FireFox) and will not be aligned with the left edge of the image.
Code [URL] Line 154:
Code JavaScript:
ShowView.prototype.setImageSrc = function (imagesrc) {
var image = $('img#image');
[code]...
From what I can tell the `container.width(imageWidth);` is not rendered in IE8 or IE9. If the page is refreshed then it works. Using the built in developer tool shows the correct value in the html but if you use selector tool in the developer tool outline does not reflect the changed width value.I've tried using vanilla javascript. That did not work. I've tried setting the image source twice. That did not work either.
View 2 Replies
View Related
Feb 25, 2009
I'm having an issue in that when I display:inline a DIV onClick, the DIV is not expanding to the width specified in the stylesheet. Similarly, my TDs would not use their colspan attribute.
View 4 Replies
View Related
May 25, 2011
I've set up jcarousel and configured it to work how I need it to, apart from one thing; I need the images to keep their width - height ratio when the browser is resized.
I'm using the Flexible carousel configuration and the width of the images changes appropriately when the window is resized, but the height stays the same, I need it to change.
View 3 Replies
View Related
Jul 19, 2011
I got this working in chrome and was happy until I got to check out IE8! Enough said about that.The code I have now will work (in both chrome and IE8) if I manually set the height and width of the image but I cannot get them dynamically, for instance if images have different sizes, I've been trying for a while now but cannot get anywhere with it.The code I am currently using (of my own creation) is;
$("#lightbox_image_container").html('<img id="lightbox_image" src="http://www.veritywebdesign.com/gallery/gallery_images/image.jpg" />');
$("#lightbox_image").load(function() {
// image_width = $("#lightbox_image").width();
[code]....
How do I get the height and width dynamically after loading the image?
View 1 Replies
View Related
Oct 4, 2010
let me try to explain better what I'm trying to do. I'm a real newbie I don't know much javascript but I understand more or less the logic behind it... tell me if this solution should work and if you know how to do it please show me. [URL]... I need to make div#photo's width to match the total width measurement of all the images it contains. If you load the page and you don't touch the size, it will work fine... but that's not realistic. If I resize the page, which will happen often on this kind of page (I'm assuming), the whole thing goes haywire (try it, scroll to the last image and resize the page you'll see what I mean). What can I do? Is my idea the right solution? Am I not explaining this clearly enough? Let me know please, I'm desperate. I've been trying to get CSS to do this for me for 3 hours now. Nothing works.
View 6 Replies
View Related
Apr 26, 2011
Is there any way that one could have supersubs functionality applied to drop-down multi-column menus?I assume one would need to calculate the width of each column plus the combined width for the container.
View 1 Replies
View Related
May 5, 2010
I currently have a website where i share thoughts with my friends (some kind of forum) and within this 'forum' people can post pictures they made but most of the time these pictures exceed the max width of my website so my website gets all streched out!So this is what i want: all images on the page must run thru some sort of function which checks if the image image width exceeds the max_width. if it does then the script must calculate how many pixels the current width exceeds the max_width and get this number so that the script does: current_width = current_width - (max_width - current_width)
View 1 Replies
View Related
Jun 4, 2011
I am trying to setup a javascript function that sets a div's width based on the combined width of the li's with the name "navItem". The problems I have been running into when trying to define the width of the li's is that they do not have a width defined in css. Can anyone help me out with this? The javascript function setWindow is suppose to show the div loginWindow and set the width of it.
Code:
<div id="topNav">
<ul>
<li><img src="<?php print $site->folder['images']['header']; ?>topmenu_left.jpg" border="0" alt="" /></li>
<li name="navItem"><a href="<? print $site->url['about']; ?>">About Us</a></li>
<li name="navItem"><a onmouseover="setWindow('loginWindow');" href="<? print $site->url['billing']; ?>">Client Services</a></li>
[Code]...
View 3 Replies
View Related
Jul 28, 2010
Is the next jQuery code the best way to decrease an elements width?[code]I tried using the next code:[code]but that's not working, also not with '-20'.Maybe it's an idea to add this functionality? It's is already used in the .animate() function for changing the position of an element.
View 3 Replies
View Related
Sep 10, 2009
I need a code that when a button or image is clicked then a div's width and height are changed.
Ive managed to get a few codes that does this, but the real problem is that, the contents of the div is an embedded flash file and i thought that by setting the flash width and height to 100% then the flash would fit to the new size of the div, but it just didnt work.
I need a code that when a button is clicked then the div's and the flash's width and height are changed.
please have a look at the temp website latinunit net / temp / , you will understand where im coming from.
on the right hand side i have a flash chat in a div , div is controled by a script that allows it to follow the scrollers up and down.
My goal is to add a little button in the same div that says expand or maximise so when clicked the the div expands aswell as the flash file.
View 4 Replies
View Related
Jun 2, 2010
I got a table, first tr got 10 td, how to get the sum of the first three td's width
All I know is like:
Is there any solution via jQuery?
View 1 Replies
View Related
Nov 5, 2011
I want to set the width of a div to be the same width of the image inside the div.The following code works great. But...The images are different widths, so both wrappers are set to the width of the first image. Without having to add an ID to each wrapper or image, can the wrapper width be set to the image width using the name of the image as the unique identifier?
jQuery:
$(document).ready(function(){
var newWidth = $('div.wrapper img').attr('width');
$('div.wrapper').width(newWidth);
});
HTML:
<div class="wrapper">
<p><img src="image1.jpg" width="200" /><br />
Caption</p>
</div>
[code].....
View 7 Replies
View Related
Jul 23, 2005
<img src=http://xxx.com/yyy.jpg
onmouseover="settimeout("document.location='http://www.google.com'"),
2000">
I want to have a 2 seconds delay before it is directed to an URL when the
mouse is over the image.
However, it seems that setTimtOut does not like parameters in the function
part.
View 5 Replies
View Related
May 28, 2010
I'm caching some html into a file and pulling in the file via ajax into a div a second after the page loads.I do div.innerHTML = ajax.responseText; It works fine except the inline <script> in the html don't run.Basically it comes down to this not workingdiv.innerHTML = "<script>alert('hi');</script>";Does nothing.How do I get around this problem? I need the scripts to run and be stored in the same html file that is loaded in and displayed after the initial page load.
View 4 Replies
View Related
Dec 12, 2006
I've read through a number of links that discuss various methods of
resizing a div; however, nothing seems to work correctly for me. The
basic idea is that I would like to implement is a panel that can be
hidden (to save space), but collapses smoothly, rather than all at
once.
I've tried setting the div's style.height property. Doing so does, in
fact, resize the div (at least in Firefox 2.0); however, the inner text
does not disappear as the div is resized. Should I apply another CSS
style to the inner text or is there another method of obtaining the
desired results? Code:
View 4 Replies
View Related
Sep 20, 2009
<div id="resizetest" style="width:200px;height:200px;border:2px solid blue">
<div style="background:#000033">
<a href="#" style="float:right;background:#ffffff" onclick='document.getElementById("resizetest").height="50";'>_</a>[code]....
Why doesn't this resize? I've looked at examples, and I don't see what's wrong.
View 5 Replies
View Related
Feb 3, 2006
I have a function that is used to take the contents of various text
boxes, sum them, and write the results to another text box. I have
this function set-up to handle the constiuent text boxes' onBlur
events, and it works great. One of the things it does is it uses the
isBlank method of the string containing the contents of each text box
before it tries to do math on it:
function checkTotal(clientID,id) {
..
..
..
e = document.getElementById(clientID);
if (e) {
strValue=e.value.toString();
alert(strValue);
if (!strValue.isBlank())
..
..
..
I want this script to run when the page loads. This code is generated
deep in an ASP.Net user control, and I can't come-up with a good way to
execute this code in the page's body's onLoad. So I am writing the
following as in-line JavaScript at the bottom of the FORM:
<script language="JavaScript">
checkTotal('txtBudgetLaborHours','BudgetLaborHours ');
</script>
The function executes fine up until it gets to the isBlank method.
I've used alert's to verify that the text box in fact does have the
proper value when this method is called, but when the script goes to
execute the isBlank method I'm getting an "object does not support this
property or method" error.
Has anyone seen anything like this before? Is there a reason the
isBlank function isn't available at this point in the page's life?
View 1 Replies
View Related
Apr 4, 2007
I'm looking for a way to have the user enter a date as 03042007
for April 3rd 2007, and have that turned into 03.04.2007 as you type.
Is there an easy way to have "03" automatically turned into "03.",
then the next two digits into "04." to construct the valid date entry
as you go?
I'm trying to get the same effect as what you have, for those of you
who know Delphi or C++Builder, an EditMask field like "##.##.####"
Is this possible?
View 14 Replies
View Related
Apr 21, 2009
Code...
So generally what I'm trying to do is send an array of form IDs to a javascript function and have it wipe any default values. my clearHWD() and clearBpc() functions work fine but I'm looking for a way to do it dynamically: my attempt can be seen in clearThis function. can anyone tell me where I'm doing this wrong OR whether this is even possible.
View 11 Replies
View Related
Dec 8, 2009
can a get the inline calender with the controls as shown in figure.I already developed calender only using java script. But not able to select date using the same inline calender.
View 1 Replies
View Related
Jan 11, 2009
why I should use the dom level 2 event handling over inline events like ...
Code HTML4Strict:
<a href="http://www.yahoo.com" onClick="myFunction()">click me</a>
I work in a team of developers and our pages are dynamically created using Java.I can at any moment change the inline JS across a site due to this so changes are easier then if the site was just static HTML.As far as reasons to use dom 2 over inline, I looking for something beyond:
it separates behavior from html
it is a best practice
it is the 'modern' way of doing it
I need facts that explain why it is a best practice or why 'modern' is better like : you can only assign one function action to the event.That was just an example which I see but is not true to me.I can either assign multiple functions to it like:
Code HTML4Strict:
<a href="http://www.yahoo.com" onClick="myFunctionA();myFunctionB();myFunctionC()">click me</a>
or I can call my functions from a single function call like
Code HTML4Strict: <a href="http://www.yahoo.com" onClick="myMultiFunctionCall()">click me</a>
and then have a function defined before the inline call like
Code JavaScript:
function myMultiFunctionCall()
{[code].....
Here the second statement overwrites the first.By the way, here is a con for using dom and to me a big one considering debugging: you can't see what event handlers are assigned to what unlike inline where it is obvious because it is in the page. see http:[url].......
View 5 Replies
View Related
Feb 9, 2011
I've been teaching myself javascript and I'm a bit confused about the whole events business. I've been reading the Sitepoint book (among a bunch of others) and when it gets to Ch 4 things get down right confusing. They claim that inline event handlers are "so 1998", something I've heard before and then they proceed to write some pretty complex library files to get around the fact that IE <= 7 doesn't support much of the alternative ways of handling events--a familiar enough story. Anyhow, it seems that many many tutorials all over the internet (and countless pages) resort to inline event handlers as the standard. So, I'm confused. I obviously need to know inline event handlers if I intend to work as a web developer even though it's so 1998. Obviously inline even handlers are not quite on par with inline font attributes and transparent gif files despite the language one often hears. Can someone set me straight, and if possible suggest a brilliant tutorial, book chapter, or website that lays everything crystal clear for me?
View 14 Replies
View Related