Jump to content

Can I get a simple php code to measure how many words per minute someone cantype


qinazaza

Recommended Posts

!-- TWO STEPS TO INSTALL TYPING TEST:

   1.  Copy the coding into the HEAD of your HTML document
   2.  Put the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Add this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- Original: Michael Tartaglia <stonedstan@hotmail.com> -->
<!-- Web Site:  http://www.geocities.com/SiliconValley/Horizon/5235 -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- 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("You can not change that!");
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("\nYou typed a " + word + " word sentence in " 
+ totalTime + " seconds, a speed of about " + spd + " words per minute!")
}
else {
alert("You made an error, but typed at a speed of " + spd + " words per minute.")
   }
}
// End -->
</SCRIPT>
</HEAD>

<!-- STEP ONE: Put this code into the BODY of your HTML document  -->

<BODY>

<CENTER>
<FORM name="theForm">
<TABLE BORDER=3 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD>Are you a....</TD>
<TD align=center><input type=radio name="sme" value="Beginner" onClick="s()" checked>Beginner
<input type=radio name="sme" value="Novice" onClick="m()">Novice
<input type=radio name="sme" value="Expert" onClick="e()">Expert</TD>
</TR>
<TR><TD colspan=2><BR>
<center><input type=button value="Start Typing Test" 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="DONE"  name="stop"  onClick="stopIt()"></center></TD>
</TR>
</TABLE></FORM>
</CENTER>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  3.33 KB  -->

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.