logophobia 0 Report post Posted October 22, 2004 I have this small javascript that is supposed to resize an iframe. It works when I replace the var name with normal numbers but not with a variable input. Could someone help me out pls? Here is the script:<script type="text/javascript">var forumheight = window.height - 120;document.write("<iframe src=\"http://forums.xisto.com/no_longer_exists/; width=\"99%\" height=\"" + forumheight + "\"></iframe>");</script>thx in advance Share this post Link to post Share on other sites
logophobia 0 Report post Posted October 23, 2004 sr, fixed it. Saw something on the internet that helped. Share this post Link to post Share on other sites
LuciferStar 0 Report post Posted October 23, 2004 Do you mean this: [/br]function change(var x)[br]{[/br]var forumheight = x;[br]document.write("<iframe src=\"http://tim.trap17.com/forum/\" width=\"99%\" height=\"" + forumheight + "\"></iframe>");[/br]} Share this post Link to post Share on other sites
logophobia 0 Report post Posted October 23, 2004 nonono, nevermind. i meant if you replaced the var in the document.write with a number. Its meant to resize an Iframe to fit in the window. It works now just in firefox, not in IE. IE seems to ignore the width settings. Could anyone help me with this:<script type="text/javascript">var myHeight = 0;var myWidth = 0;if( typeof( window.innerWidth ) == 'number' ) {myHeight = window.innerHeight;myWidth = window.innerWidth;}else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {myHeight = document.documentElement.clientHeight;myWidth = document.documentElement.clientWidth;}else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {myHeight = document.body.clientHeight;myWidth = document.body.clienWidth;}else{myHeight = window.height;myWidth = window.width;}myWidth = myWidth - 4;myHeight = myHeight - 133;document.write("<iframe src=\"http://forums.xisto.com/no_longer_exists/; width=\"" + myWidth + "\" height=\"" + myHeight + "\"></iframe>");</script> Share this post Link to post Share on other sites
logman92 0 Report post Posted October 23, 2004 Good news !!I was integrating your script in a basic HTML page and I found the anomaly !Go to the line 15 and correct it like this myWidth = document.body.clientWidth;You only forgot the "t" of "client". I recommend you to debug your program with command like alert('...') in JavaScript, it helps to localize little bugs in all scripts Share this post Link to post Share on other sites
logophobia 0 Report post Posted October 23, 2004 thx alot. Ill try that Share this post Link to post Share on other sites