You are here: Re: javascript and strict doctype « HTML « IT news, forums, messages
Re: javascript and strict doctype

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация