@KorMay 07.2010 — #You can't. At least not in this way.
It looks like your logic is contradictorily. Once you found an element and gave it a property, that means you referred it somehow, thus why to find it again using that property as an identifier? [I]You already have the reference of that element somewhere[/I], otherwise you could not have given it that property, could you?
Do I miss something? Can you exemplify your aim with a concrete HTML element?
@misha680authorMay 07.2010 — #Your logic would make perfect sense except the framework I am using to execute Javascript is the Java SWT (IBM) Browser object, which does not remember objects between execute commands.
@mrhooMay 07.2010 — #If an object doesn't have an id, you can assign one the first time you look at it. [CODE] document.uids=1; document.hoozit= function hoozit(obj){ if(obj.nodeType!=1) return ''; if(!obj.id) obj.id= 'uid_'+document.uids++; return obj.id; }[/CODE]
@KorMay 10.2010 — # which does not remember objects between execute commands.[/QUOTE] Not very clear to me, but if those commands change the session, you should probably use a cookie. Or a server-side session variable. JavaScript is a client-side language - it does not keep nor track the changes between sessions.
@misha680authorMay 10.2010 — #Thank you. My apologies if unclear my program is on the _browser side_ so now way (?) to set cookies on the server.
In other words I _execute Javascript_ from the browser side to traverse/manipulate the DOM model.
I will have to double check if assigning IDs to elements will work when finding the object... in other words, I understand the ID will be assigned, but not sure it will be retained by my next call to the Browser's "execute Javascript" command.
This is the browser object in SWT btw if you are interested.