wfcvn 发表于 2007-4-27 10:10:57

***游戏类***速度练习 测试你打字的速度

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
要完成此效果需要两个步骤

第一步:把如下代码加入到<head>区域中

<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

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>


第二步:把如下代码加入到<body>区域中

<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()">


      











------- --------- ----------- -------- ---

ht t p ://www.huoyue.com.cn活跃 网,活跃人群的论坛 ,访问活 跃网,将给您带来 意想不到的收获,还可以免费为您开论坛, 让您免费拥有与朋友、网友 交流的论坛。你是年轻人吗?你活跃你 就上!
页: [1]
查看完整版本: ***游戏类***速度练习 测试你打字的速度