Friday, March 14, 2008

How open / show div on same place where mouse pointer Click

How open / show div on same place where mouse pointer clicks


[html]

[head]

[title]Test21[/title]

[style type="text/css"]

#sekrit {

display: none;

width: 100px;

height: 100px;

background-color: #dddddd;

border: 1px solid #000000;

position: absolute;

}

[/style]

[script type="text/javascript"]

function mouseOver(e) {

if (e == null) e = event;

var sekrit = document.getElementById('sekrit');

sekrit.style.display = 'block';

sekrit.style.left = e.clientX+'px';

sekrit.style.top = (e.clientY-sekrit.offsetHeight)+'px';

}

function mouseOut(e) {

// add stuff here

}

[/script]

[/head]

[body]

[br/][br/][br/][br/][br/][br/][br/]

[a href="#" onmouseover="mouseOver(event)" onmouseout="mouseOut(event);"]Test[/a]

[div id="sekrit"]Y HELO THAR![/div]

[/body]

[/html]

No comments: