Why not just define a global variable, like

<script type="text/javascript">var divID = 0;</script>

and use that when assigning the ID, while incrementing the value for
the next......

So a super quick example

http://paste.pocoo.org/show/94617/







On Dec 9, 3:51 pm, brian <[EMAIL PROTECTED]> wrote:
> or: DOMWindow -- open with selector
>
> I'm writing a plugin that creates a div with a form and attaches it to
> the document, hidden. There may be several of these on the page so I
> dispensed with IDs, choosing to use class selectors to get at them to
> display, etc.. So far, this has been fine.
>
> However, I'd like to have the option to use a DOMWindow to display
> these divs. I'd like to assign a click handler to my button which
> would open the corresponding div. The problem is that DOMWindow only
> seems to accept an ID for the div from which to get the inline
> content. There doesn't appear to be any way to pass it a selector
> string (both strange and unfortunate).
>
> It looks like I'll need to add IDs to my hidden divs, though, as I
> said, there's no telling how many will be created on a page. I've read
> that appending datetime to an ID string isn't guaranteed to provide
> unique strings. Does anyone have any hints for a bullet-proof way to
> do that?
>
> Or, should I just hack this feature into DOMWindow and get on with things?
>
> [1]http://swip.codylindley.com/

Reply via email to