Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
#tst1 {
position:absolute;visibility:hidden;z-Index:101;top:50px;left:150px;width:150px;height:100px;background-Color:#FFFFCC;border-Left:solid black 1px;border-Top:solid black 1px;border-Bottom:solid black 1px;
}
#tst2 {
position:absolute;visibility:hidden;z-Index:101;top:200px;left:150px;width:150px;height:100px;background-Color:#FFFFCC;border-Right:solid black 1px;border-Top:solid black 1px;border-Bottom:solid black 1px;
}
#form {
position:absolute;top:5px;left:5px;font-Size:12px;
}
#form INPUT {
font-Size:12px;
}
#table {
width:300px;height:300px;background-Color:#99CC66;
}
/*]]>*/
</style>
<script type="text/javascript">
/*<![CDATA[*/
function Draw(mde,id,col,bcol){
var obj=document.getElementById(id);
var w=zxcSVInt(obj,'width'),h=zxcSVInt(obj,'height');
var box=zxcES('DIV',{position:'absolute',left:(mde=='left'?w:-h/2)+'px',top:'0px',width:h/2+'px',height:h+'px'},obj);
var ary=[];
if (mde=='left') ary=ary.concat(zxcLine(box,[0,0],[h/2,h/2],[0,0],bcol),zxcLine(box,[0,h],[h/2,h/2],[0,h],bcol));
else ary=ary.concat(zxcLine(box,[h/2,0],[0,h/2],[h/2,0],bcol),zxcLine(box,[h/2,h],[0,h/2],[h/2,h],bcol));
ary=ary.sort(function(a,b){ return a[0]-b[0]; });
for (var z0=0;z0<ary.length;z0+=2){
zxcES('DIV',{position:'absolute',left:ary[z0][0]-(mde=='left'?0:h/2)+'px',top:Math.min(ary[z0+1][1],ary[z0][1])+'px',width:'1px',height:Math.max(Math.abs(ary[z0+1][1]-ary[z0][1])-h,0)+'px',backgroundColor:col},box);
}
}
function zxcLine(obj,srt,fin,os,bcol){
var w=fin[0]-srt[0],h=fin[1]-srt[1],hyp=Math.sqrt(w*w+h*h),xr=w/hyp,yr=h/hyp;
for (var ary=[],z0=0;z0<hyp;z0++){
ary[z0]=[Math.floor(z0*xr+srt[0]+os[0]),Math.floor(z0*yr+srt[1]+os[1])];
zxcES('DIV',{position:'absolute',overflow:'hidden',zIndex:'1',left:z0*xr+os[0]+'px',top:z0*yr+os[1]+'px',width:'1px',height:'1px',backgroundColor:bcol},obj);
}
for (var rary=[ary[0]],z1=1;z1<ary.length;z1++){
if (ary[z1][0]!=ary[z1-1][0]) rary.push(ary[z1]);
}
return rary;
}
function zxcES(ele,style,par,txt){
if (typeof(ele)=='string') ele=document.createElement(ele);
for (key in style) ele.style[key]=style[key];
if (par) par.appendChild(ele);
if (txt) ele.appendChild(document.createTextNode(txt));
return ele;
}
function zxcSVInt(obj,par){
if (obj.currentStyle) return parseInt(obj.currentStyle[par.replace(/-/g,'')]);
return parseInt(document.defaultView.getComputedStyle(obj,null).getPropertyValue(par.toLowerCase()));
}
function Pop(obj,p,p1,p2,frm){
p=document.getElementById(p);
if (p.lst) zxcES(p.lst,{visibility:'hidden'});
if (p.cb&&p.cb!=obj) p.cb.checked=false;
var pos=zxcPos(p);
var pop=zxcPos(obj)[0]<zxcPos(p)[0]+p.offsetWidth/2;
var box=document.getElementById(pop?p1:p2);
zxcES(box,{visibility:obj.checked?'visible':'hidden',left:(pop?(pos[0]-box.offsetWidth-box.offsetHeight/2-5):(pos[0]+p.offsetWidth+box.offsetHeight/2+5))+'px',top:zxcPos(obj)[1]-box.offsetHeight/2+obj.offsetHeight/2+'px'});
zxcES(document.getElementById(frm),{},box);
p.lst=box;
p.cb=obj
}
function Hide(id){
var obj=document.getElementById(id);
zxcES(obj.lst,{visibility:'hidden'});
obj.cb.checked=false;
}
function zxcPos(obj){
var rtn=[obj.offsetLeft,obj.offsetTop];
while(obj.offsetParent!=null){
var objp=obj.offsetParent;
rtn[0]+=objp.offsetLeft-objp.scrollLeft;
rtn[1]+=objp.offsetTop-objp.scrollTop;
obj=objp;
}
return rtn;
}
/*]]>*/
</script>
</head>
<body onload="Draw('left','tst1','#FFFFCC','#000000');Draw('right','tst2','#FFFFCC','#000000');">
<div id="tst1" ></div>
<div id="tst2" >
<form id="form" >
User Name:<br />
<input name="user" />
<br />
Password:<br />
<input name="password" />
<br />
<input type="submit" name="Submit" value="Submit" />
<input type="button" name="Cancel" value="Cancel" onclick="Hide('table');"/>
</form>
</div>
<center>
<table id="table">
<tr>
<td><input type="checkbox" name="" onclick="Pop(this,'table','tst1','tst2','form');"/></td>
<td><input type="checkbox" name="" onclick="Pop(this,'table','tst1','tst2','form');" /></td>
</tr>
</table>
</center>
</body>
</html>
Bookmarks