<script language="javascript">
var var1,word,killword,rig02=0,err02=0,num=0,num2=0,numper=0
function sysword()
{
word="QWERTYUIOPLKJHGFDSAZXCVBNM".charAt(Math.floor(Math.random()*26));
document.getElementById(word).style.background="pink"
sys.innerText=word;
}
sysword()
document.onkeydown=function()
{
var1=String.fromCharCode(event.keyCode)
if(var1==word)
{
rig.innerText=(++rig02)
}
else
{
err.innerText=(++err02)
diverr.style.visibility="visible"
setTimeout("diverr.style.visibility='hidden'",500)
}
document.getElementById(word).style.background="#fffff0"
if(/[^A-Z]/g.test(var1))
{
alert("请按字母键!");
}
else
{
document.getElementById(var1).style.background="red";
sysword();
}
}
document.onkeyup=function()
{
document.getElementById(var1).style.background="#fffff0";
num=rig02+err02
num2=rig02/num
num2=num2*100
num2=Math.round(num2)
spanpercent.innerText=num2+"%"
numper=num/vartime
numper=numper*10
numper=Math.round(numper)
numper=numper/10
spanspeed.innerText=numper
}
var vartime=0
setInterval("spantime.innerText=(++vartime)",1000)
</script>