Popup placement

J

Jenny

Hi all,

how can place a popup window relative to the assigned
button instead of relative to the documents body?

I'm using: oPopup.show(15,150,50,50,document.body);

But the popup is shown if a button is clicked, so I like
the popup to be shown relative to the button!

Thx
Jenny
 
R

Ravikanth[MVP]

Hi

Pass parameters where actually button positioned.
depending on that relatively open pop up window.

HTH
Ravikanth[MVP]
 
V

Vidar Petursson

Hi

Do something like this to get the element pos

<head>
<script>
function icyGetElementPos(oElement){
var e = ( typeof(oElement) == "object") ? oElement : null;
var o = {x: 0, y:0};
while(e)
{
o.x += parseInt(e.offsetLeft,10);
o.y += parseInt(e.offsetTop,10);
e = e.offsetParent;
}
return o;
}
function doIt(oEl){
var o = icyGetElementPos(oEl);
alert(o.x + "/" + o.y + "\nElement posY + ElementHeight: " +
oEl.offsetHeight);
}
</script>
</head>
<body>
<form>
<input type="button" value="click me to get my pos"
onclick="doIt(this)"><br>
<input type="button" value="click me to get my pos"
onclick="doIt(this)"><br>
<input type="button" value="click me to get my pos"
onclick="doIt(this)"><br>
</form>
</body>
</html>

Hope this helps

--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top