PDA

View Full Version : Cool Tip: setAttribute and getAttribute 'val' argument supports binary references!


tspratt
02-12-2004, 03:46 PM
I am instantiating LZNodes using the "new" keyword, based on a dataset.

I discovered that I could use setAttribute() on my new node to assign a reference to my lzDataElement, then access that data node with getAttribute().

 olznodeNew.setAttribute("lzdeRef", olzdeSource);
and (in mouseover handler, for example)
 olzdeSource = oControl.getAttribute("lzdeRef");

I could do this in DHTML, and am pleased to find I can do it in Laszlo.

If this is well known and documented, I apololgize for the redundant post.

Is is supported intentionally, by the way?
Tracy

antun
02-12-2004, 09:35 PM
Absolutely - this is normal JavaScript behavior. When you assign variable values in JS, you're basically passing pointers.

Note that you don't have to use getAttribute at all.

-Antun