Jump to content

how to get ACTUAL size of control


ejay

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...