模拟windows control的进度条[1]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 koolfoo 的 blog

<html><head>
<title>xyprogresslg xo</title>
<script>
 function xyprogresslg(xyid){
  this.xyprogressid = 'oprogress' + math.random().tostring().substr(2, 10) + xyid;

  this.max = 0;
  this.min = 0;
 
  this.width = 100;
  this.height = 20;
  this.currpos = 0;
  this.outerbordercolor = "black";
  this.outerbackcolor = "white";
  this.innerbordercolor = "";
  this.innerbackcolor = "blue";
  this.textcolor = "red";

  this.setprogresstop = xysetprogresstop;
  this.setprogressleft = xysetprogressleft;
  this.setprogresswidth = xysetprogresswidth;
  this.setprogressheight = xysetprogressheight;
  this.setprogressbordercolor = xysetprogressbordercolor;
  this.setprogressforebordercolor = xysetprogressforebordercolor;
  this.setprogressbackcolor = xysetprogressbackcolor;
  this.setprogressforecolor = xysetprogressforecolor;
  this.enableprogresstext = xyenableprogresstext;
  this.setprogresstextfontsize = xysetprogresstextfontsize;
  this.setprogresstextfontcolor = xysetprogresstextfontcolor;
  this.setprogresstextfontfamily = xysetprogresstextfontfamily;

  this.setprogressmax = xysetprogressmax;
  this.setprogressmin = xysetprogressmin;
  this.updateposition = xyupdateposition;
  this.updatetoposition = xyupdatetoposition;
  this.updatepersent = xyupdatepersent;
  this.updatetopersent = xyupdatetopersent;

  xyprogressinit(this.xyprogressid);
  return this.xyprogressid;
 }
 function xyprogressinit(xyid){
  var div = document.createelement("div");
  div.id = xyid;
  div.style.position = "absolute";
  div.style.left = "100px";
  div.style.top = "100px";
  document.body.appendchild(div);

  var pro = document.createelement("div");
  pro.style.position = "absolute";
  pro.style.left = "0px";
  pro.style.top = "0px";
  pro.style.fontsize= "0px";
  pro.style.width = "100px";
  pro.style.height = "20px";
  pro.style.border = "1px solid black";
  pro.style.background = "white";
  pro.style.zindex = "100";
  div.appendchild(pro);

  var proinner = document.createelement("div");
  proinner.id = xyid+"_inner";
  proinner.style.position = "absolute";
  proinner.style.left = "1px";
  proinner.style.top = "1px";
  proinner.style.fontsize= "0px";
  proinner.style.width = "0px";
  proinner.style.height = "16px";
  proinner.style.border = "1px solid black";
  proinner.style.background = "blue";
  pro.style.zindex = "102";
  pro.appendchild(proinner);

  var text = document.createelement("div");
  text.style.position = "absolute";
  text.style.left = "50px";
  text.style.top = "2px";
  text.style.fontsize= "11px";
  text.style.width = "40px";
  text.style.height = "16px";
  text.style.zindex = "103";
  div.appendchild(text);
 }
 function xysetprogresstop(pstyletop){
  try{
   var e = document.all(this.xyprogressid);
   e.style.top = pstyletop;
  }catch(e){
   alert(e.description);
  }
 }
 function xysetprogressleft(pstyleleft){
  try{
   var e = document.all(this.xyprogressid);
   e.style.left = pstyleleft;
  }catch(e){
   alert(e.description);
  }
 }
 function xysetprogresswidth(pwidth){
  try{
   var e = document.all(this.xyprogressid);
   e.style.width = pwidth;
   eouter = e.children(0);
   eouter.style.width = pwidth;
   this.width = pwidth;
  }catch(e){
   alert(e.description);
  }
 }
 function xysetprogressheight(pheight){
  try{
   var e = document.all(this.xyprogressid);
   e.style.height = pheight;
   eouter = e.children(0);
   einner = e.children(0).children(0);
   eouter.style.height = pheight;

本文关键:progress,forms,javascript
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top