|
|
|
|
![]() ![]() |
Oct 22 2004, 11:14 PM
Post
#1
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 86 Joined: 19-October 04 From: Alkmaar, the netherlands Member No.: 1,832 |
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://tim.trap17.com/forum/\" width=\"99%\" height=\"" + forumheight + "\"></iframe>"); </script> thx in advance |
|
|
|
Oct 23 2004, 12:30 AM
Post
#2
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 86 Joined: 19-October 04 From: Alkmaar, the netherlands Member No.: 1,832 |
sr, fixed it. Saw something on the internet that helped.
|
|
|
|
Oct 23 2004, 07:58 AM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 114 Joined: 9-August 04 From: Suzhou Jiangsu China Member No.: 743 |
Do you mean this:
CODE function change(var x) { var forumheight = x; document.write("<iframe src=\"http://tim.trap17.com/forum/\" width=\"99%\" height=\"" + forumheight + "\"></iframe>"); } |
|
|
|
Oct 23 2004, 11:46 AM
Post
#4
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 86 Joined: 19-October 04 From: Alkmaar, the netherlands Member No.: 1,832 |
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://tim.trap17.com/school\" width=\"" + myWidth + "\" height=\"" + myHeight + "\"></iframe>"); </script> |
|
|
|
Oct 23 2004, 01:10 PM
Post
#5
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 10 Joined: 22-October 04 From: Paris, France Member No.: 1,880 |
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 CODE 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 |
|
|
|
Oct 23 2004, 03:40 PM
Post
#6
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 86 Joined: 19-October 04 From: Alkmaar, the netherlands Member No.: 1,832 |
thx alot. Ill try that
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 05:46 PM |