You use the camel case to get the z-index like so:

myElementZ = $(myElement).getStyle(zIndex);

Also, sometimes it can be a pain to realize that myElementZ is not an
integer. So, a parseInt(myElementZ) should guarantee that it can be
used for further calculations.

Not sure why you want to obtain any default values. IMHO, default
values can be notorious because of different browsers so the best way
to do things would be to always put your own value to it if it's
absolutely necessary.

One thing I frequently do is use a statement to get the topmost layer
z-index in the following way:
topZ_current = $$("div").invoke("getStyle", "zIndex").max();

Again, parseInt is required if you need the value for calculations,
which is probably the reason you did get it. Add 1 to it and place
your new element on top of the topmost layer...

Hope this helps you.

On Aug 12, 9:36 pm, kstubs <> wrote:
> When calling getStyle, do you call out the style by camel-case?  So:
> myElement.getStyle('zIndex');
> -or-
> myElement.getStyle('z-index');
> Also, if the style has not been defined, as in z-index for example, you can
> expect a null return type, but aren't there default values that might be
> returned?
> Karl..

You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to