How to set width / height of a DIV using Javascript in Firefox

In IE it works, 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.

+4
source share
1 answer

Note. I am not familiar with the Javascript helper library you are using.

I assume 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"; 
+8
source

All Articles