Core code is collected on the Internet (IE6, 7,8, Firefox/3.6.11 and tt4.8 are tested successfully ).
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> No title page </title>
<SCRIPT type = "text/JavaScript">
Function createpopup (){
VaR setelementstyles = function (element, styledict ){
VaR style = element. style;
For (VAR stylename in styledict) style [stylename] = styledict [stylename];
}
VaR ediv = Document. createelement ('div ');
Setelementstyles (ediv, {'position': 'absolute ', 'top': 0 + 'px', 'left': 0 + 'px ', 'width ': 0 + 'pxy', 'height': 0 + 'pxy', 'zindex': 1000, 'display': 'none', 'overflow': 'hidden '});
Ediv. Body = ediv;
VaR opened = false;
VaR setopened = function (B ){
Opened = B;
}
VaR getopened = function (){
Return opened;
}
VaR getcoordinates = function (oelement ){
VaR coordinates = {X: 0, Y: 0 };
While (oelement ){
Coordinates. x + = oelement. offsetleft;
Coordinates. Y + = oelement. offsettop;
Oelement = oelement. offsetparent;
}
Return coordinates;
}
Return {
Htmltxt :'',
Document: ediv,
Isopen: getopened (),
Isshow: false,
Hide: function (){
Setelementstyles (ediv, {'top': 0 + 'px', 'left': 0 + 'px', 'width': 0 + 'px', 'height ': 0 + 'px ', 'display': 'none '});
Ediv. innerhtml = '';
This. isshow = false;
},
Show: function (IX, Iy, iwidth, iheight, oelement ){
If (! Getopened () {document. Body. appendchild (ediv); setopened (true );};
This.html TXT = ediv. innerhtml;
If (this. isshow) {This. Hide ();};
Ediv. innerhtml = this.html txt;
VaR coordinates = getcoordinates (oelement );
Ediv. style. Top = (IX + coordinates. X) + 'px ';
Ediv. style. Left = (Iy + coordinates. Y) + 'px ';
Ediv. style. width = iwidth + 'px ';
Ediv. style. Height = iheight + 'px ';
Ediv. style. Display = 'block ';
This. isshow = true;
}
}
}
VaR opopup; // controls the display of images
If (! Window. createpopup ){
Opopup = createpopup ();
}
Else {
Opopup = Window. createpopup ();
}
Function filloutimage (imgurl, eventtag ){
With (opopup.doc ument. Body ){
Style. backgroundcolor = "lightyellow ";
Style. Border = "solid black 1px ";
Innerhtml = " ";
}
VaR event = eventtag | window. event;
Opopup. Show (event. clientx + 80, event. clienty + 10,300,250); // the size of the form
}
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
</Div>
<Div id = "divhere"> </div>
</Form>
</Body>
</Html>