PDA

View Full Version : Problem with Iframe...



john2078
05-29-2008, 03:58 PM
Hi All,

I am Using IFrame control in my page to display page in that, but my roblem is when i
increase the resultion of the machine Iframe dosent increase the Hieght of frame, and leave blank space between frame and window.

how can i change the size of frame depend on the user's machine resolution.

any idea can any one give me

Thanks in advance

-John

jscheuer1
05-29-2008, 05:16 PM
It's not really clear what you mean exactly. Could you be more specific? Often, something like that can be dealt with by setting the dimensions of the iframe as percentages. That way, the larger the window, the larger the iframe, ex:


<iframe width="70%" height="50%" . . . ></iframe>

But to get the height right this way when there is no container other than the window (body of the page), you cannot use a valid URL DOCTYPE for your page. If there is a container other than the body, it must also be set to resize to available height somehow.

john2078
05-30-2008, 02:59 PM
Hi,

Thanks for ur reply. i m using below code to resize the frame.



function onResultWindowResize(sName)
{
var adj = 25;

var newWinHeight = window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;

document.getElementById(sName).style.height = (newWinHeight-adj) + 'px'

}

It is working on my machine if i put the adj value by adjusting.

but on the user browser due to diffrenet resultion it is changing the frame size.

is there any other way how to over come this problem.

how to find the resultion on user machine or x and y coordinate of user browser.

Thanks
-john

jscheuer1
05-30-2008, 03:21 PM
I'm not getting why you would want the x and y cords of the browser window. Those would be the left and top positions of the browser on their screen, and would have no relationship to the browser window's dimensions or the user's resolution.

The user's resolution is:


screen.width

by:


screen.height

But that won't tell you much about the size of their window, you already are doing a fairly good job of finding that (its height, at least). Perhaps, instead of using a fixed value from here:



var adj = 25;

you could probably get a better result by defining it as a portion of the user's window height here:


document.getElementById(sName).style.height = (newWinHeight-Math.floor(newWinHeight*0.10)) + 'px'

0.10 would make the 'adjustment' 10% of the window height.

However, (as always) it would be best to develop a layout that isn't so sensitive to various resolutions and screen sizes.

john2078
05-30-2008, 04:19 PM
Thanks Again.

I have tried below code:

document.getElementById(sName).style.height = (newWinHeight-Math.floor(newWinHeight*0.10)) + 'px'

it now working, Is there any way to find the resolution of the machine so depend on the resolution i can adjust the size of frame.

Regards,
John

jscheuer1
05-30-2008, 05:46 PM
The resolution is as I said:


The user's resolution is:


screen.width

by:


screen.height

But that won't tell you much about the size of their window, you already are doing a fairly good job of finding that (its height, at least).

Like if you did:


alert (screen.width + ' X ' + screen.height);

It would give you something like:

800 X 600

or:

1440 X 900 (mine)

or:

1024 X 768 (another common one)

etc.

But this tells you nothing about the size of the browser window, or about the size of the text being displayed in it.