ASP.NET(C#)

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

<script>
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() {
var mysms = []
mysms[0] = "你是衰人呀,打字这么慢!";
mysms[1] = "很差劲呀,要多加强练习!";
mysms[2] = "慢慢来,我相信你还是会有进步的!";
mysms[3] = "还不错,有前途!";
mysms[4] = "很棒啊,你教教我好不好啊!";
mysms[5] = "你真是高手啊,前无古人,后无来者哦!";
mysms[6] = "欢迎您来测试!";
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 + " 个字符!");
var aa = document.getElementById("sms");
if(spd<3){
     aa.innerText = mysms[0];
     }else if(spd>=3&&spd<10){
     aa.innerText = mysms[1];
     }else if(spd>=10&&spd<20){
     aa.innerText = mysms[2];
     }else if(spd>=20&&spd<30){
     aa.innerText = mysms[3];
     }else if(spd>=30&&spd<200){
     aa.innerText = mysms[4];
     }else if(spd>=200){
     aa.innerText = mysms[5];
     }else{
     aa.innerText = mysms[6];
     }
}
else {
alert("你输入有错,但是你每秒钟输入 " + spd + " 个字符.")}}
</SCRIPT><FORM name="theForm">
<TABLE BORDER=3 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><span id="sms">你是个...</span></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()"></textarea></TD>
</TR>
<TR><TD colspan=2><center><input type=text name="typed" size=45>
<input type=button value="完成"  name="stop"  onClick="stopIt()"></center></TD>
</TR>
</TABLE></FORM>

posted on 2005-07-11 19:26  battlerstar  阅读(932)  评论(0编辑  收藏  举报