|
|
|
|
![]() ![]() |
![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 86 Joined: 19-October 04 Member No.: 1,832 |
Post
#1
Oct 22 2004, 11:14 PM
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 |
![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 86 Joined: 19-October 04 Member No.: 1,832 |
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 114 Joined: 9-August 04 From: Suzhou Jiangsu China Member No.: 743 |
Post
#3
Oct 23 2004, 07:58 AM
Do you mean this:[br] CODE [/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]}
|
![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 86 Joined: 19-October 04 Member No.: 1,832 |
Post
#4
Oct 23 2004, 11:46 AM
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> |
![]() Group: Members
Posts: 10 Joined: 22-October 04 From: Paris, France Member No.: 1,880 |
Post
#5
Oct 23 2004, 01:10 PM
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 |
![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 86 Joined: 19-October 04 Member No.: 1,832 |
|
![]() ![]() |
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
10 | Vacant | 5,848 | 3rd June 2009 - 05:11 PM Last post by: proskiier23 |
|||
![]() |
10 | holyium | 10,349 | 25th September 2004 - 12:33 AM Last post by: spyshow |
|||
![]() |
3 | Vacant | 8,119 | 26th August 2004 - 09:09 AM Last post by: Vacant |
|||
![]() |
2 | reciter | 10,121 | 30th January 2005 - 06:17 AM Last post by: jordanliuhao |
|||
![]() |
5 | reciter | 3,760 | 14th January 2005 - 08:16 PM Last post by: MaRiOnI |
|||
![]() |
7 | Mike | 4,507 | 30th April 2009 - 10:32 PM Last post by: webishqiptar |
|||
![]() |
2 | kvarnerexpress | 3,130 | 5th June 2009 - 03:06 PM Last post by: k_nitin_r |
|||
![]() |
3 | nancmu | 6,646 | 14th January 2005 - 09:02 PM Last post by: vizskywalker |
|||
![]() |
2 | solankyno1 | 4,673 | 17th January 2005 - 10:07 PM Last post by: alapidus |
|||
![]() |
3 | MacFly | 3,414 | 23rd January 2005 - 06:22 AM Last post by: LuciferStar |
|||
![]() |
1 | clemen | 9,357 | 24th February 2005 - 01:42 AM Last post by: ill |
|||
![]() |
8 | ppj | 2,208 | 18th April 2005 - 07:53 PM Last post by: wariorpk |
|||
![]() |
0 | andrewsmithy | 2,070 | 19th March 2005 - 04:46 AM Last post by: andrewsmithy |
|||
![]() |
19 | andrewsmithy | 14,465 | 11th February 2010 - 08:50 PM Last post by: iG-wem |
|||
![]() |
2 | AskAndrewD | 1,101 | 7th November 2007 - 08:21 PM Last post by: Paul1582 |
|||
|
Open Discussion | Time is now: 21st March 2010 - 08:23 PM |
Web Hosting Powered by ComputingHost.com.
Xisto.com : HONESTY ROCKS! truth rules.