View Full Version : using document.body.style.zoom & top.document.body.clientHeight

10-19-2003, 07:15 PM
i use 2 javascript funcitons to automatically zoom and unzoom the document to the window size.

the function in the parent is

function zoom(){
var y=document.body.clientHeight;
var x=document.body.clientWidth;
factor=(((x/1010)<(y/670))? x/1010: y/670);
return document.body.style.zoom=factor;

and the function in the iframe content is

function unzoom(){
x = top.document.body.clientWidth;
y = top.document.body.clientWidth;
factor=(((x/1010)<(y/670))? 1010/x: 670/y);
return document.body.style.zoom=factor;

the reason why i call the unzoom function is to make sure that the text in the iframe does not become too big or too small, it works well on the first load, (both body and iframe content scales correctly) but after i click on the navigation bar (to cahnge the contents of the iframe), the iframe scales incorrectly, and i have to reload the page before it display correctly.

iframe's window.alert(x) returns the correct value the first time, and a value around 1000-1200 the after i click the navigation link.

navigation link function is by document.getElementById("content").src=link; (content is the id of the iframe)

I will appreciate if someone can give me a workaround to this problem.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum