Michael,

If you want to identify the division at the time of the event you could
either create the div with a specific ID, or you could add an index field.

Example:
<html>
        <head>
                <title>DynAPI 2 Tutoial - Mouseevents Listener</title>
                <script language="Javascript"
src="../src/dynapi.js"></script>
                <script language="Javascript">

                        DynAPI.setLibraryPath('../src/lib/');
                
                        DynAPI.include('dynapi.api.*');
                        DynAPI.include('dynapi.event.*');
                
                </script>
                <script language="Javascript">

                        DynAPI.onLoad=function() {

                                div0=new DynLayer('first', 100, 0, 100, 50,
'#909090');
                                div1=new DynLayer('second', 100, 50, 100,
50, '#a0a0a0');
                                div2=new DynLayer('third', 100, 100, 100,
50, '#b0b0b0');
                                div3=new DynLayer('fourth', 100, 150, 100,
50, '#c0c0c0');
                                div4=new DynLayer('fifth', 100, 200, 100,
50, '#d0d0d0');
                                div5=new DynLayer('sixth', 100, 250, 100,
50, '#e0e0e0');
                                div6=new DynLayer('seventh', 100, 300, 100,
50, '#f0f0f0');
                        
        
divArray=[div0,div1,div2,div3,div4,div5,div6];
                        
                                DynAPI.document.addChild(div0);
                                DynAPI.document.addChild(div1);
                                DynAPI.document.addChild(div2);
                                DynAPI.document.addChild(div3);
                                DynAPI.document.addChild(div4);
                                DynAPI.document.addChild(div5);
                                DynAPI.document.addChild(div6);
                                
                                for (i = 0; i < divArray.length; i++)
                                 {
                                        divArray[i].index=i;
                                        divListener = new
EventListener(divArray[i]);
        
divArray[i].addEventListener(divListener);
                                        divListener.onmouseover =
function(e) {
                                                target = e.getTarget();
        
target.setHTML(target.id+"<br>index#: " + target.index);
                                        }
                                        divListener.onmouseout = function(e)
{
                                                target = e.getTarget();
                                                target.setHTML("&nbsp");
                                        }
                                }
                                
                        }               
                </script>       
        </head>
        <body>
        </body>
</html>


        -----Original Message-----
        From:   Michael Kraus [SMTP:[EMAIL PROTECTED]]
        Sent:   Tuesday, December 18, 2001 4:32 AM
        To:     Alexander Litvinov
        Cc:     DynApi
        Subject:        RE: [Dynapi-Help] EventListeners being dynamically
set up on Array items.

        Err... point taken, but a little pedantic in terms of actual
        functionality... :)

        (I am act. using onmouseout in my code...)

        Thanks though I'll make sure I use the right code...

        But do you have any ideas about what I am trying to do?

        All the best...

        Michael.




_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to