By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,665 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,665 IT Pros & Developers. It's quick & easy.

Need to get Height and Width of an object (Mozilla 1.4)

P: n/a
Using Mozilla 1.4... I need to get the Height and Width of an object (in
this case, a parent DIV) for the purpose of creating a textbox of max width
and height in the container. Since innerHeight/Width don't work correctly
in Mozilla 1.4, I've tried using getComputedStyle as noted in another
newsgroup, but with no success; errors tend to range from "Cannot create
object in this context" to other various errors...

The below sample doesn't work, so I'm hoping someone can help me with a
coherent approach that will work... :)

Thanks!
Jack

winW=document.defaultView.getComputedStyle(documen t.getElementById('myContai
ner'),null).getPropertyValue('width');
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
DU
Jack Black wrote:
Using Mozilla 1.4... I need to get the Height and Width of an object (in
this case, a parent DIV) for the purpose of creating a textbox of max width
and height in the container. Since innerHeight/Width don't work correctly
in Mozilla 1.4,
? innerWidth and innerHeight are window properties and they do work
correctly in Mozilla 1.4.

I've tried using getComputedStyle as noted in another newsgroup, but with no success; errors tend to range from "Cannot create
object in this context" to other various errors...

But that's a creation element error message, not related to computed style.
The below sample doesn't work, so I'm hoping someone can help me with a
coherent approach that will work... :)
It would have been a lot more easier to figure out your difficulties
with an url.

Thanks!
Jack

winW=document.defaultView.getComputedStyle(documen t.getElementById('myContai
ner'),null).getPropertyValue('width');

var ContainerWidth = document.getElementById("myContainer").clientWidth ;
var ContainerHeight = document.getElementById("myContainer").clientHeigh t;

var objTextbox = document.createElement("input");
objTextbox.type = "text";
objTextbox.style.width = ContainerWidth + "px";
objTextbox.style.height = ContainerHeight + "px";
etc...
and then you need to append objTextbox to a block-level element within
the form.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #2

P: n/a
Thanks for responding... However, Mozilla is reporting an error on the
first assignment:
Error: document.getElementByID is not a function
Source File: <snipped>
Line: 1562

Can't believe how difficult Mozilla (and NN) make this compared to IE... ;-)

Thanks for trying.
Jack


"DU" <dr*******@hotREMOVEmail.com> wrote in message
news:bf**********@news.eusc.inter.net...
Jack Black wrote:
Using Mozilla 1.4... I need to get the Height and Width of an object (in this case, a parent DIV) for the purpose of creating a textbox of max width and height in the container. Since innerHeight/Width don't work correctly in Mozilla 1.4,
? innerWidth and innerHeight are window properties and they do work
correctly in Mozilla 1.4.

I've tried using getComputedStyle as noted in another
newsgroup, but with no success; errors tend to range from "Cannot create
object in this context" to other various errors...


But that's a creation element error message, not related to computed

style.
The below sample doesn't work, so I'm hoping someone can help me with a
coherent approach that will work... :)


It would have been a lot more easier to figure out your difficulties
with an url.

Thanks!
Jack

winW=document.defaultView.getComputedStyle(documen t.getElementById('myContai ner'),null).getPropertyValue('width');

var ContainerWidth = document.getElementById("myContainer").clientWidth ;
var ContainerHeight = document.getElementById("myContainer").clientHeigh t;

var objTextbox = document.createElement("input");
objTextbox.type = "text";
objTextbox.style.width = ContainerWidth + "px";
objTextbox.style.height = ContainerHeight + "px";
etc...
and then you need to append objTextbox to a block-level element within
the form.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #3

P: n/a
"Jack Black" <ja*************@hotmail.com> writes:
Thanks for responding... However, Mozilla is reporting an error on the
first assignment:
Error: document.getElementByID is not a function
The final "D" should be lowercase, you probably typo'ed it.
Can't believe how difficult Mozilla (and NN) make this compared to IE... ;-)


That is probably because you know IE but not Mozilla, otherwise you might
say the converse.

Please respond below the parts of the message you are replying to, and
delete the parts you are not replying to.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.