47、虚拟格式化硬盘

47、虚拟格式化硬盘

<script LANGUAGE="JAVASCRIPT">

var timerID=null;

var count=0;

var running=false;

function RandomNumber(max)

{var today = new Date();

  var num= Math.round((Math.abs(Math.sin(today.getTime()))*1000))%max+1;

  return num;

}

function stopaction()

{if (running)

   clearTimeout(timerID);

 running=false;

}

function startaction()

{ stopaction();

  action();

}

function action()

{if (count!=100)

  { document.outputform.output.value="正在格式化硬盘,目前进度:"+count+"%";

     count++;

     timerID=setTimeout("action()",200+RandomNumber(500));

     running=true;

  }

  else

   { document.outputform.output.value="格式化完毕 ... ...";

      stopaction();

   }

}

</script>

<body onload="startaction()">

<p>虚拟格式化</p>

<form name="outputform">

  <p><input TYPE="TEXT" NAME="output" size="50"></p>

</form>

 

Write a comment

Comments: 0