HTML - Iframe, Auto Resize?
Hi, So i need some help. I hope i post this at the right place.
I'm making a website, and i want the iframe to have auto resize, because the first page is a news page, and will therefor end up being pretty long, i dont want a scroll bar inside the iframe because i dont like the way it looks. I found a javascript thing that helped with i resize, the iframe extends if the news page gets longer with the news i post. BUT. if i go to any other page on the website, the iframe keeps the first pages height, and i dont want that, i want it to "shrink" and be as long as the information inside the iframe. this is the website right now, far from done by the way. http://martin.scorpionshops.com/spwebsite/index.html and as you can see the height of the iframe stays the same if you klick on any of the links in the menu, is there a way to fix this? this is the code that ive applied to the iframe and such on the index page where the iframe is located <!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"> <head> <link rel="stylesheet" type="text/css" href="stylesheet.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SimplePlanWorldwide</title> </head> <body topmargin="0" link="black" vlink="black" alink="black"> <script language="JavaScript"> <!-- function autoResize(id){ var newheight; var newwidth; if(document.getElementById){ newheight=document.getElementById(id).contentWindow.document .body.scrollHeight; newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth; } document.getElementById(id).height= (newheight) + "px"; document.getElementById(id).width= (newwidth) + "px"; } //--> </script> <div align="center"> <table width="1024" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="4" background="header.jpg" height="294" border="0"> </td> </tr> <tr> <td colspan="4" height="65" border="0"><img src="menu.jpg" border="0" usemap="#Map2"></img></td> </tr> <tr> <td width="227" height="108" background="welcome.jpg" border="0"><p><font size="1" face="arial narrow" vlink="black" hlink="black" color="#ffffff"><br> Welcome to SimplePlanWorldwide!<br> SimplePlanWorldwide.com is a fansite for Simple Plan <br> and we are here to give you the latest about the band<br> and feed your Simple Plan cravings. Enjoy!</font></p></td> <td width="196" height="108" background="sitestats.jpg" border="0"><font size="1" face="arial narrow" vlink="black" hlink="black" color="#ffffff" valign="left"><br> <B>Owner:</B> Matilda | About <br> <B>Launched:</b> 2012.30.05 <br> <b>Layout:</b> Version 1.0<br> <b>Like this site?</b> Bookmark us!</font></td> <td width="204" height="108" background="disclaimer.jpg" border="0"><p><font size="1" face="arial narrow" vlink="black" hlink="black" color="#ffffff"><br> SimplePlanWorldwide is not affiliated with the <br> band, Simple Plan, Pat, Frenchie, Atlantic Records</font><font size="1" face="arial narrow" vlink="black" hlink="black" color="#ffffff"><br> or Lava Records, and we don't know the guys<br> personally. We're just a fansite for SP.</font></p></td> <td><img src="linksofficial.jpg" width="397" height="108 border=" border="0" usemap="#Map"0"></td> </tr> </table> <table width="1024" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top" witdh="755" background="mainbackground.jpg" border="0" repeat="norepeat"><br> <center><iframe align="top" SRC="news.php" width="100%" height="200px" name="iframe1" id="iframe1" marginheight="0" frameborder="0" onLoad="autoResize('iframe1');"></iframe></center> </td> <td valign="top" width="269" background="sidebackground.jpg" border="0"> <div class="twitter"> <center><br> <script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'list', rpp: 8, interval: 30000, title: '', subject: 'SIMPLE PLAN TWEETING', width: '250', height: 700, theme: { shell: { background: 'transparent', color: '#999999' }, tweets: { background: 'transparent', color: '#444444', links: '#000000' } }, features: { scrollbar: false, loop: false, live: true, behavior: 'all' } }).render().setList('matildawr', 'simple-plan').start(); </script> </div></td> </tr> </table> <map name="Map" id="Map"> <area shape="rect" coords="7,22,151,77" href="http://www.simpleplanfoundation.org" target="_blank" alt="map" /> <area shape="rect" coords="164,13,226,100" href="http://www.officialspcrew.com" target="_blank" alt="map" /> <area shape="rect" coords="236,23,388,82" href="http://www.merchdirect.com/simpleplan" target="_blank" alt="map" /> </map> <map name="Map2" id="Map2"> <area shape="rect" coords="86,6,148,42" href="news.php" target="iframe1" alt="menumap" /> <area shape="rect" coords="190,7,331,40" href="information.html" target="iframe1" alt="menumap" /> <area shape="rect" coords="372,7,434,40" href="tour.html" target="iframe1" alt="menumap" /> <area shape="rect" coords="610,6,738,41" href="multimedia.html" target="iframe1" alt="menumap" /> <area shape="rect" coords="772,5,833,38" href="www.html" target="iframe1" alt="menumap" /> <area shape="rect" coords="474,6,568,38" href="http://martin.scorpionshops.com/spwebsite/forum/" target="_blank" alt="gallerymap" /> </map> </body> </html> So.. do you have any ideas? I dont know much css or javascript, or php for the matter, but i am willing to learn to make it work, so ANY methods that will make this work, just help me Similar TutorialsI don't know if this question is posted somewhere, but I can't seem to find the answer I'm looking for. I'm currently using iframe for my posting entries, and I can't figure out the script for auto height. I'm tired of setting the height by hand, every time my entries starts to stretch. Now regarding the width, would that be possible too? if not, I'm not too concerned. Most important is the height. If anyone have the answers to this please reply. Thanks in advance! (: I am having a problem with images that vary in size. I let the user upload images and then display it on a web page. The problem is that the images that the users submit are different sizes. Some look good while others look distorted. Any Ideas? Hey all.. Is it possible to have the browser resize the src inside an iframe? I'm loading up a website in an iframe, and it's just a tad larger then what I have room for in my content area.. I know that I can restrict the size of the frame itself, but then I'm left with those nasty scroll bars.. Thanks David Hi, One of my files is calling an iframe inside a single table. The code looks like following iframe.htm ========================================================================== <html> <head> <title> New Document </title> </head> <body topmargin="0" leftmargin="0" style="overflow:auto"> <table cellpadding="0" cellspacing="0" height="100%" width="100%"> <tr> <td><iframe name="parent_iframe" src="frames.htm" frameborder="0" framespacing="0" height="100%" width="100%" scrolling="yes"></iframe></td> </tr> </table> </body> </html> ========================================================================== frames.htm has following code ========================================================================== <html> <head> <title>Denials Management System</title> </head> <frameset rows="50%,*" border="1" bordercolor="black" marginheight="0" marginwidth="0" framespacing="0"> <frame src="frame_top.htm" scrolling="yes" name="topFrame"> <frame src="frame_bottom.htm" scrolling="yes" name="bottomFrame"> </frameset> <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"> </body> </html> ========================================================================== Everything works fine. The only problem is resize functionality doesn't work in 'frames.htm'. After trying few options, I have found that if I remove height attribute from table (height="100%") in 'iframe.htm', resize starts working. But, this shrinks the iframe vertically. I have tried all other options but nothing makes the resize working. I am facing this problem with IE7. It works perfect with Mozilla Firefox 2.0. IE7 doesn't produce any error but the resizing simply doesn't work. Can someone help me please ? Thanks in advance. Regards, Sandeep Hey. I am using iframe inside my site, but i have to choose width and height myself.. when i set it to auto, i still have to scroll. Heres my site: http://habbxtra.net HTML Code: <iframe src="hjem_frame.php" width="450px" height="1200px" name="mainframe" frameborder="0" scrolling="no"</iframe> Ive tried changing height to auto and not setting a height at all, and setting the height to 100%, but when i change to 100% in width it wont show, and when i chane haight to 100% it doesnt do anything, just the same as width auto. Thanks for any reply ! hi, i've a very simple html page, where i have an iframe. The problem is that i want to add some text below the iframe. however, my text keeps showing up on the right hand side of the iframe. i've looked at the tutorials discussing the tags available for iframe, but surprisingly, none seem to relevant to this. Code: <html> <body> <table border="0" cellspacing="10"> <table border="0" cellpadding="0" cellspacing="0" align="left"> <td valign="top"> <iframe src="mySource.jsp" height="700" width="600" frameborder="0" scrolling="auto"></iframe> </td> </table> This should be displayed below the iframe but actually gets displayed on the right </body> </html> any help / guidance in this will be much appreciated. thanks in advance! I have 2 IFrames on a page. I am going to end up with a long list of shows to catch-up on. Is there a way I can embed an IFrame with the list, and when you click on a show, you it will change the Playing Show http://tiny.cc/catchup <---The page I am referring to. Hello, I wrote the following HTML code: HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Admin Page</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> </head> <body> <div id="main"> <h2>Admin Page</h2> <hr width="420" color="black" align="left"> <form method="post" action="$_SERVER[PHP_SELF]" name="form" > <div class="textbox" style="height:35px;"> Username: <input type="text" id="username" name="username" maxlength="30" /> </div> <div class="textbox"> Password: <span style="position: relative; left: 4px;"><input name="password" type="password" id="password" maxlength="30" /></span> </div> <br /> <div class="button"> <input type="submit" value="Sign In" name="submit"> </div> </form> <hr width="420" color="black" align="left" style="position: relative; top: -5px;"> <div id="info"> info here </div> </div> <!-- End main div --> </body> </html> and the following CSS code: HTML Code: body { background-color:gray; font-family:Comic Sans MS; font-size:12pt; color:black; } #info { font-family:sans-serif; font-weight:bold; position:relative; left:0px; width:420px; top:20px; } #main { position:relative; width:500px; left:420px; top:50px; } The problem I have is when you resize the browser nothing resizes. Can someone please help me get this page to resize? Help will be greatly appreciated. Thanks. I have read a bunch of stuff on this and checked the 14 pages, but I am getting confused. Will I be able to have my site open up full size according to the setting of the user computer by added a script to my site pages? TIA I am having a frustrating problem with IE7. I have a set of images that load in the proper place when the page loads in IE7. Then, if you resize the browser in any way the images do not move, but the rest of the page moves with the browser resize. This causes the images to go over other items on the page instead of staying where they should when the resize occurs. Does anyone have an idea about what the difference between Mozilla and and IE7 is that makes this type of problem occur? Anything I should look into or try to make the images "stick" to their proper place during a resize in IE7? Thanks. Hi all, I notice that on some websites when you minimize and maximize the window, the content on the site displays differently. For example if i reduce the browser window on this website - all content is still displayed as if it were open in a fully maximised window. What is this called? and How do you do it?? Cheers Raggy http://wantedfraternity.webs.com/oncall.html I cant resize the font of the "GOM" in the center. Its set at 13, but I need it around 18px. :-\ Help here plz. Hello, i need help understanding how to make my website automaticly resize depending on the resolution its viewed on i am viewing it on 1680 x 1050 and it looks fine but i then view it on a smaller monitor and everything gets moved about and squished, i notice on other websites that this is not the case and i do not know how its possible. my website url: http://mylocalmenu.co.uk/ you are able to view the source code and css files from the browser please help me with this problem, as it is the only problem i cannot fix. Thank you in advance to any help that i receive Hi, I am a photographer and am trying to build my own site. Am using dreamweaver 8 and am ok using it, but my html is a little rubbish. have been developing my site, www.robertallenweddingphotography.co.uk, however just realised i have been developing at 1024x768 but if you look at the site at a lower or higher resolution it looks v.bad. Have read a few bits and pieces about using % instead of set pixels?! but am a bit lost! Can any body point me in the right direction? Basically want to end up with a site that looks 'correct' to as many people as possible! Thanks Rob Hi All, We have images which are displayed in panel series. We have images if all sizes and width, we have tried using width=100% which makes all the images to fit the width allotted, which makes the image BLUR if the image is very small. Is there a way by which we can have width=100% for only the oversize images and leave the others as it is. Regards, Nagesh i have a floating div who's height is determined by content, i would like acquire that div's hight and apply it's hight to a div on the page, when the page loads... I have no earthly idea where this should actually go, so feel free to move. Our webpage is approx. 650 pixels across, which translates into too large of a document to be printable. It slices off a small amount of the right-hand side of the page when folks try to print it from IE. I noticed that when using Firefox though, the page is automatically resized to fit into an 8.5x11 space. If I want to add a "Print this page" element to the page, is there code that would tell the website to automatically resize itself to fit into a letter-sized document? I tried looking for tutorials but there either aren't any or I was getting the keywords wrong. Just curious, as this would be a helluva lot easier than resizing the entire site pixel-wise. Thanks for any suggestions =) Hello! I am pretty new to HTML, but I was asked to make a webpage for my girlfriend's small business. What I want to do is copy the style used on the main image of this website: http://www.stellamccartney.com/. What I am looking to do is take an image and have it resize whenever I resize the browser window. If you can tell, the image is actually zooming in and out in order to maintain its correct ratio. I am not interested in copying anything else from this website, only the way the main image works. Looking at the source code has me baffled; I believe they wrote this using javascript, but I can't tell. If anyone knows how to create a similar effect as this site I would greatly appreciate the help. Thank you! Evening all, I'm looking for some simply coding to tell an image to resize to fit into a frame that is defined in the CSS layout. The image size needs to be reduced to 630x402, the original size is much greater. <SCRIPT LANGUAGE="JavaScript"> var theImages = new Array() theImages[0] = 'images/main_img.jpg' theImages[1] = 'images/main_img2.jpg' theImages[2] = 'images/main_img3.jpg' theImages[2] = 'images/main_img4.jpg' var j = 0 var p = theImages.length; var preBuffer = new Array() for (i = 0; i < p; i++){ preBuffer[i] = new Image() preBuffer[i].src = theImages[i] } var whichImage = Math.round(Math.random()*(p-1)); function showImage(){ document.write('<img src="'+theImages[whichImage]+'">'); } </script> <div id="main_img"><SCRIPT LANGUAGE="JavaScript">showImage();</script></div> I need someway of implementing the size change into the coding somewhere. Thank you for any help in advance! |