473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
3 14850
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: delerious | last post by:
I need to determine an element's width and height in pixels (not including padding, border, and margin) in Javascript. The element will not have width or height styles specified. In Mozilla, I...
6
by: Jason Bassford | last post by:
Okay, What I'm trying to do is create two boxes, one on top of the other. The first is a static height, the 2nd, underneath it, should take up the remaining amount of screen space and overflow...
2
by: patrick h. | last post by:
Greetings, I am encountering some issues regarding using float while desiring to set the height to 100%. This is likely due to my own misunderstanding of the way things actually function -- any...
1
by: bin_P19 P | last post by:
the code i have got is as follows and now im stuck <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Shopping...
5
by: Dave Hammond | last post by:
You'd think this would be a basic part of the window object (and perhaps it is and I'm just being dense), but I can't find any reference in the IE window object documentation to a property which...
22
by: Les Juby | last post by:
I am trying to adjust the window/table size of a website (www.worklaw.co.za) which has made use of DIV tags with its settings embedded in an CSS file. The client wants its width and height to...
2
by: Atul | last post by:
I am unable to find image height and width in mozilla firefox. My code is working in IE but not in Mozilla. How can i find image width and height in mozilla? function check(sel) { if(sel != "")...
1
by: since | last post by:
How do I get a html table in mozilla to only have scrollbars if it is exceeds a height. "max-height" used to work but it no longer works for me. I can scrollbars added if it exceeds a height. In the...
1
by: soms2m | last post by:
HELLO ALL, I want to fill the parent window height with respect to the sub window height which is loading using ajax (mootools). For example if the parent window height is normal and the loading...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.