in DynAPI.onLoad (You need to include the event files) :
        ....
        pageX=0;
        pageY=0;
        var d = new EventListener()
        d.onmousemove = function(e) {
                pageX = e.getPageX();
                pageY = e.getPageY();
        }
        DynAPI.document.addEventListener(d);
        ....

Now you will have two global variables pageX and pageY that will
always give you the current location of the mouse.  So in your
mouseovers you can just use those variables.

-- 
Robert Rainwater


On 3/29/2001, 4:18:34 PM EST, Rodrigo wrote about "[Dynapi-Help] Mouse position in 
document - How to track?":

> Hi.

> I could add DynLayers by using onMouseOver events in a common <A> link.
> Now I need to set the X and Y position of the layer basead in the mouse
> position of the document.

> The result I'm trying to get is simple: just open a DynLayer at the mouse
> position when it runs over a common <A> link. And I don't need to change
> those values. Just see the code below. It's quite simple.

> Any ideas?
> Thank you!

> Volponi

> <html>
> <head>
> <title>DynAPI Distribution: Delete Example</title>
> <script language="Javascript" src="dynapi/src/dynapi.js"></script>
> <script language="Javascript">
> DynAPI.setLibraryPath('dynapi/src/lib/');
> DynAPI.include('dynapi.api.*');
> </script>
> <script language="Javascript">

> function MakeLayer(text,sizex,sizey){
> /* --------------------------------------------------
> I have to check the mouse here, to return mouse positioning values
> -----------------------------------------------------*/
>     mousex = 200
>     mousey = 200
> /* --------------------------------------------- */
>     var dlyr = new DynLayer(null,mousex,mousey,sizex,sizey,'yellow');
>  dlyr.setHTML(texto);
>  DynAPI.document.addChild(dlyr);
> }

> function DeleteLayer(){
>  if (DynAPI.document.children.length>0) {

> DynAPI.document.children[DynAPI.document.children.length-1].deleteFromParent
> ()
>  }
>  else alert('All layers are removed.')
> }

> </script>
> </head>

> <body>
> <a href="#" OnMouseOver="javascript:MakeLayer('My own text',200,50)"
> onMouseOut="javascript:DeleteLayer()">Make layer</a><br>


> </body>
> </html>


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



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

Reply via email to