A Firefox 3 JavaScript gotcha for web site builders

Here's a little gotcha in Firefox 3.0 for web site designers. My website was incorrectly formatted in Firefox 3, but worked fine in Firefox 2. I had some JavaScript code that did the following: mainTabDiv.style.left = (mainTabBarLeft-mainTabBarDX)+'px;'; mainTabDiv.style.top = mainTabBarTop+'px'; With that code in Firefox 3, mainTabDiv was not positioned correctly -- it was at 0. So I put in an alert: alert(" left="+mainTabDiv.style.left+" mtbl="+mainTabBarLeft+" mainTabBarDX="+mainTabBarDX); and got the following output: left= mtbl=270 mainTabBarDX=2 Can you spot the problem? The first statement in my source has px; and the second one has px. That is, the failing statement had a semicolon at the end of the string. In Firefox 2 this work... view original article
Thu, 10 Jul 2008 16:30:01 +0200

more MacOSXHints.com articles
  • no related articles found at MacOSXHints.com