function $(a){
  return document.getElementById(a)
}

function calculateOffset(field, attr){
 var offset =">

JS的确认DIV

80酷酷网    80kuku.com

  js

<script type="text/javascript">
function $(a){
  return document.getElementById(a)
}

function calculateOffset(field, attr){
 var offset = 0;
 var count = 0;
   while(field) {
     offset += field[attr];
     field = field.offsetParent;
   }
   return offset;
}

function calculateOffsetLeft(field){
 return calculateOffset(field, "offsetLeft");
}
 
function calculateOffsetTop(field){
 return calculateOffset(field, "offsetTop");
}
 
function chooseCourseResult(){
 o = $('resultDiv');
 if(o!=null)o.removeNode(true);
 var frm = document.feeUserAccountForm;
 var l = calculateOffsetLeft($("chooseCourseFieldSet"))+$("chooseCourseFieldSet").offsetWidth/2;
 var t = calculateOffsetTop($("chooseCourseFieldSet"));
 var b=document.createElement("DIV");
 b.id="resultDiv"; ea=1; Ma=1;
 b.style.borderRight="black "+ea+"px solid";
 b.style.borderLeft="black "+ea+"px solid";
 b.style.borderTop="black "+Ma+"px solid";
 b.style.borderBottom="black "+Ma+"px solid";
 b.style.zIndex="2";
 b.style.paddingRight="0";
 b.style.paddingLeft="0";
 b.style.paddingTop="0";
 b.style.paddingBottom="0";
 b.style.left=l+"px";
 b.style.top=t+"px";
 b.style.width="500px"
 b.style.visibility="";
 b.style.position="absolute";
 b.style.backgroundColor="white";
 b.innerHTML = "<table width='100%' height='106'>"
 + "<tr><td> 您已为学员:</td></tr>"
 + "<tr><td valign='bottom'><font "<c:out value='${votedUsers}'/>"+ "</font></td></tr>"
 + "<tr><td><b>成功选课</b></td></tr>"
 + "<tr><td align='center'><input type='button' class='btn' value=' 确 定 ' onclick='$(\"resultDiv\").removeNode(true);'></td>"
 + "</tr></table>";
 document.body.appendChild(b);
}
</script> 



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: