Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Need Help With This Javascript
timstokman
post 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
Go to the top of the page
 
+Quote Post
timstokman
post 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. smile.gif
Go to the top of the page
 
+Quote Post
LuciferStar
post 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>");
}
Go to the top of the page
 
+Quote Post
timstokman
post 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>
Go to the top of the page
 
+Quote Post
logman92
post 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". wink.gif

I recommend you to debug your program with command like alert('...') in JavaScript, it helps to localize little bugs in all scripts cool.gif
Go to the top of the page
 
+Quote Post
timstokman
post 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 smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Javascript Slideshow Tutorial(7)
  2. Image Preloader With Progress Bar Status(23)
  3. Javascript Close Window(15)
  4. Adding Rows & Columns In Html Table Using Javascript(1)
  5. What's The Relationship Between Javascript And Java(7)
  6. Playing Flash Movies Without The One-click Activation: Simple Insertion Of Javascript(5)
  7. Web Page Tree Menu: Style Sheet - Javascript(6)
  8. Learn Html Quick And Easy(15)
  9. Can I Make Dynamic Menu In Php(7)
  10. Simple Javascript And Password System(9)
  11. Do You Close The Javascript?(4)
  12. Document.write & Noscript Questions (javascript)(2)
  13. Make A Moderately-secure Password System Using Javascript(10)
  14. Lesser Known Useful Javascript Features(2)
  15. Making A Picture Viewer Website(3)
  1. Javascript And Ajax For The Web, Sixth Edition Review(0)
  2. Creating A Floating Javascript Docking Menu(1)
  3. Browser Compatibility Problem With Firefox - Javascript + Css(3)
  4. Seeking Help With Javascript(1)
  5. Video Play Like Youtube(6)
  6. Validating Javascript(2)
  7. Need Help With Javascript Drag And Drop Script(2)
  8. New Javascript Engine For Firefox(5)
  9. Free Javascript Library!(0)
  10. Re-learning Javascript(3)
  11. Can Do Away With Javascript?(4)
  12. Javascript Game(6)
  13. Advice For Online Game Please!(1)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 05:46 PM