Popup placement

  • Thread starter Thread starter Jenny
  • Start date Start date
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
 
Hi

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

HTH
Ravikanth[MVP]
 
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
==============================
 
Back
Top