ejay Posted November 15, 2006 Share Posted November 15, 2006 Heya:I've got an OBJECT (i.e. an active-X control) whose height and width are set to 100%. For some reason, the contol isn't sizing properly. I tried adding javascript to get the actual height/width, but it keeps returning "100%", not the pixel size. The control is nested in a <td> inside a <tr> inside a <table>. How do I find out what the containing control's size is so I can explicitly set the OBJECT's size to that? TIAejay Link to comment Share on other sites More sharing options...
Chocolate570 Posted November 15, 2006 Share Posted November 15, 2006 Because it's 100%, you can just get the width/height of your parent element. Does the td it is contained in have a specific size? Link to comment Share on other sites More sharing options...
ejay Posted November 15, 2006 Author Share Posted November 15, 2006 well...I'm looking "up" the DOM , I see no sizes on the <td>, nor on the <tr>, 100%/100% on the <table>, nothing on the <body>, nothing on the html. the whole page is inside a frame, if that helps.Cheers,ejay Link to comment Share on other sites More sharing options...
aspnetguy Posted November 15, 2006 Share Posted November 15, 2006 then you need to get the size of the frame if everything is set to 100% Link to comment Share on other sites More sharing options...
jesh Posted November 15, 2006 Share Posted November 15, 2006 Have you tried the offsetWidth and offsetHeight properties of the element? var obj = document.getElementById("myElement");var width = obj.offsetWidth;var height = obj.offsetHeight; Link to comment Share on other sites More sharing options...
ejay Posted November 16, 2006 Author Share Posted November 16, 2006 Bingo!the offsetWidth and offsetHeight seem to give the correct answers!Cheers!I'm using the actual name of the control instead of a generic object (ie. Viewer1.offsetWidth instead of using document.getElementId() ), so it seems odd (to me) that they don't come up in intellisense! But they work!Thanks everyone for your help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now