虚拟格式化硬盘
<html>
<head>
<title>格式化硬盘</title>
</head>
<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()">
<div align="center">
<p style="color:#F00">正在格式化D盘</p>
<form name="outputform">
<p><input TYPE="TEXT" NAME="output" size="50"></p>
</form>
</div>
</body>
</html>
<head>
<title>格式化硬盘</title>
</head>
<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()">
<div align="center">
<p style="color:#F00">正在格式化D盘</p>
<form name="outputform">
<p><input TYPE="TEXT" NAME="output" size="50"></p>
</form>
</div>
</body>
</html>