说明: 测试您打字的速度
效果: 运行后查看!
代码:
<!--网页特效代码由驿站http://js.jojoo.net提供!-->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
msg = new Array("Practicing with your typing can
greatly help your overall computer skills.",
"A new computer is sold in the US every hour!",
"When do birds migrate from North to South?",
"Perplexing phrases, like this one, are tougher
to type.")
word = 10
function m() {
msg = new Array("Practicing with your typing can
greatly help your overall computer skills.",
"A new computer is sold in the US every hour!",
"When do birds migrate from North to South?",
"Perplexing phrases, like this one, are tough to
type.")
word = 10
}
function e() {
msg = new Array("If you can correctly, and quickly,
type this perplexing sentence, you are one superb typist!",
"You are one superb typist if you can correctly,
and quickly, type this long phrase.",
"I believe you're a good typist, so I believe you
will correctly copy this statement!",
"Because this is not a fairly simple phrase, could
you swiftly, and precisely, copy it?")
word = 15
}
function s() {
msg = new Array("Computers are the medium of the
future.",
"Can you type this phrase rather quickly?",
"Who is the President of the US?",
"I believe that you can type well!")
word = 7
}
function beginIt() {
randNum = Math.floor((Math.random() * 10)) % 4
msgType = msg[randNum]
day = new Date();
startType = day.getTime();
document.theForm.given.value = msgType
document.theForm.typed.focus();
document.theForm.typed.select();
}
function cheat() {
alert("对不起,这里的内容你不能改变!!");
document.theForm.typed.focus();
}
function stopIt() {
dayTwo = new Date();
endType = dayTwo.getTime();
totalTime = ((endType - startType) / 1000)
spd = Math.round((word/totalTime) * 60)
if (document.theForm.typed.value == document.theForm.given.value)
{
alert("\n你输入了 " + word + " 个字符,在 "
+ totalTime + " 秒内, 速度为每分钟 " + spd + "
个字符!")
}
else {
alert("你输入有错,但是你每秒钟输入 " + spd + " 个字符.")
}
}
// End -->
</SCRIPT><FORM name="theForm">
<TABLE BORDER=3 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD>你是个...</TD>
<TD align=center><input type=radio name="sme"
value="Beginner" onClick="s()" checked>初级者
<input type=radio name="sme" value="Novice"
onClick="m()">中级者
<input type=radio name="sme" value="Expert"
onClick="e()">高级者</TD>
</TR>
<TR><TD colspan=2><BR>
<center><input type=button value="开始测试"
name="start" onClick="beginIt()"></center><P>
<textarea name="given" cols=53 rows=3 wrap=on
onFocus="cheat()">
没有相关教程
|