<div id= "Span1" >sfdsfsddfsdf</div>
<span id= "span2" style= "position:relative" >
<input id= "Input" type= "text" ></input>
<input id= "button" type= "button" ></input>
</span>
Set the button below the input
$ ("#button"). CSS ("{TOP": $ ("#input"). Offset (). top-$ ("#span2"). Offset (). top+$ ("#input"). Height,position: " Absolute "});
So the public opinion input in which position button is in the input of the bottom, the same can be applied to the calendar widget in the input text box below
1, in jquery () offset (). Top is relative to the body, and when you set the top value, you find the element that has the closest relative value to the element
In JS, you can write this:
Copy Code code as follows:
Get the absolute position of an HTML control
Calendar.prototype.getAbsPoint = function (e) {
var x = E.offsetleft;
var y = e.offsettop;
while (E = e.offsetparent) {
x + + E.offsetleft;
Y + + e.offsettop;
}
return {"X": X, "Y": y};
}
var xy = this.getabspoint (Popcontrol);
This.panel.style.left = xy.x + "px";
This.panel.style.top = (xy.y + dateobj.offsetheight) + "px";
As shown in the figure: