How to set DIV width/height with Javascript in Firefox
16,107
Note: I'm not familiar with the Javascript helper library you are using.
I'd guess that you need to change the two lines after your comment to the following:
maskEl.style.width = box.width + "px";
maskEl.style.height = box.height + "px";
Author by
John Paul Jones
Updated on June 19, 2022Comments
-
John Paul Jones almost 2 years
The following works in IE, but not Firefox:
var el = $get('divToMask'); var box = Sys.UI.DomElement.getBounds(el); var maskEl = $get('maskDiv'); // Only seems to work in IE maskEl.style.width = box.width; maskEl.style.height = box.height; Sys.UI.DomElement.setLocation(maskEl, box.x, box.y);
box.width and box.height contain the correct values, but Firefox ignores the maskEl.style .width/.height methods.
-
John Paul Jones about 15 yearsIt's the ASP.NET AJAX library. That did the trick... simple when you know how ;-)
-
Mubashar about 12 yearsit is not working in my case using firefox 10.0.2 writing this var divPatient = $("#divPatient"); divPatient.style.height = "20px"; It says divPatient.style is undefined