Wednesday, 7 November 2007

Delayed resizing of DIV in Firefox

I spent ages trying to work out why Firefox wasn't rendering a change of width for a DIV until either an alert() call or the user clicked elsewhere on the page. By contrast, IE suffered no delay.

I looked to see if there was a Javascript equivalent to DoEvents() from VBA - but seemingly not.

The eventual answer?

I was specifying
thisDiv.style.width=500;
wheras I should have been using:
thisDiv.style.width="500px";

Strangely, FF doesn't complain, or even ignore, the measurement - it just waits for another event before rendering.

No comments: