views:

74

answers:

3

i am not saying its difficult but i would like to know what way is used professionally.

what i do is declare iframes from html code and assign a scr to it,

but the problems are

switching the html code each time for declaration

the size of frame does not change/ adjust with the page in it, scroll bars do appear but thats not it

so any advice

+1  A: 

You can place your iframe's inside of div's and then use any of the many examples for resizing div's. Or any of the many examples for making a split pane that is re-sizable by the user by clicking and dragging.

You can also access the iframe's width and height attributes from javascript and dynamically change them however you want.

You'll need to provide more detail if this is completely off-base.

colithium
its what i want, but can u please provide links which help in the above two suggestions, note that iframes javascript method also tried but the problem is every content is dynamic, so basically nothing is found on the page on page load...so no size ajustment
+1  A: 

Use the onload on your iframe and recalculate/set the new width and height on your iframe.

The onload is fired when new content has been loaded inside the iframe.

Some similar: http://stackoverflow.com/questions/2531080/dynamically-resizing-navigation-div-to-main-content

On the internet you can find some example how you can get the internal width. Here is one...

http://www.infoqu.com/dev/javascript-development/getting-iframe-width-194102-1/

var the_height=document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;//find the height of the internal page

var the_width=document.getElementById('the_iframe').contentWindow.document.body.scrollWidth;//find the width of the internal page
Aristos
saw the code, but for it to work i have to call this function. dont want to do that, as the user in first shot should see it properly, he should not be required to press a button to resize the frame.
@user287745 If you read on the answer, you use the onload trigger of the iframe to run it. (user no need to press anything)
Aristos
A: 

Turn the existing pages into user controls then use them in a new page

James Westgate