<input onfocus="show(this)" onblur="hide()"/>
<div id="div1" style="position:absolute;visibility:hidden;border:1px solid black">test</div>
<script language="JavaScript">
<!--
// 2005-3-3
// forbes pu
function getLeft(el) {
return el == null ? 0 : (el.offsetLeft + getLeft(el.offsetParent));
}
function getTop(el) {
return el == null ? 0 : (el.offsetTop + getTop(el.offsetParent));
}
function show(el) {
var x = getLeft(el);
var y = getTop(el);
with (document.getElementById("div1").style) {
left = x + 'px';
top = el.offsetHeight + y + 'px';
width = el.offsetWidth + 'px';
visibility = "visible";
}
}
function hide() {
document.getElementById("div1").style.visibility = "hidden";
}
//-->
</script>
<div id="div1" style="position:absolute;visibility:hidden;border:1px solid black">test</div>
<script language="JavaScript">
<!--
// 2005-3-3
// forbes pu
function getLeft(el) {
return el == null ? 0 : (el.offsetLeft + getLeft(el.offsetParent));
}
function getTop(el) {
return el == null ? 0 : (el.offsetTop + getTop(el.offsetParent));
}
function show(el) {
var x = getLeft(el);
var y = getTop(el);
with (document.getElementById("div1").style) {
left = x + 'px';
top = el.offsetHeight + y + 'px';
width = el.offsetWidth + 'px';
visibility = "visible";
}
}
function hide() {
document.getElementById("div1").style.visibility = "hidden";
}
//-->
</script>
<!--
function cc()
{
var r = document.all.aa.getBoundingClientRect ();
alert(r.top + ":" + r.left + ":" + r.bottom + ":" + r.right);
}
//-->
</SCRIPT>
<div style="position:absolute;left:100px;top:200px;width:100px;height:200px;border:1px solid red" id=aa></div>
<input type=button onclick="cc()" value="tt">