Posted by Thomas 'PointedEars' Lahn on 09/27/74 12:01
Stanimir Stamenkov wrote:
> target_menu.style.left=(pos.x) + "px";
The parentheses are unnecessary.
> target_menu.style.top=(pos.y + pos.height) + "px";
This will most likely not work, because with this getPosition() method
pos.height would yield the value of the `height' property which would most
likely include a unit of length (the unit is not required only if the length
is 0). So for example the above could be evaluated to
target_menu.style.top = (42 + "23px") + "px";
and therefore
target_menu.style.top = "4223px" + "px";
and eventually
target_menu.style.top = "4223pxpx";
which would be an invalid property value.
It would work if pos.height would be the value of the `offsetHeight'
property of the element object instead. Same for pos.width and `offsetWidth'.
F'up2 comp.lang.javascript
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Navigation:
[Reply to this message]
|