Simple typing Games Written by jQuery and jquery typing games

Source: Internet
Author: User
Tags erro

Simple typing Games Written by jQuery and jquery typing games

Var off_x; // the abscissa var count = 0; // The total var speed = 5000; // The speed. The default value is 5 seconds. var keyErro = 0; // input error count var keyRight = 0; // enter the correct number of times // The organization letter var charArray = new Array ("A", "B ", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L ", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V ", "W", "X", "Y", "Z"); // Array of key code var arrCode = new Array (); for (var I = 65; I <= 90; I ++) {arrCode [i-65] = I;} // randomly generate a letter var randomChar = function () {off_x = Math. Random () * 500 + 5; // In the div abscissa // off_y = Math. random () * 500-10; // In the div ordinate var c = charArray [parseInt (Math. random () * 25)]; // randomly generate a letter var charHtml = "<div class = 'Char 'id = '" + c + "'style = 'left: "+ off_x +" px; color: "+ colorBox () +" '> "+ c +" </div> "; $ (" # div1 "). append (charHtml) ;}; var colorBox = function () {Color = []; // use an array to store the Color Style Color [0] = "# ff2211 "; color [1] = "# ff3311"; Color [2] = "# ff5511"; Color [3] = "# ff8811"; Color [4] = "# ff BB99 "; Color [5] =" #1ff4f1 "; Color [6] =" # ff5566 "; Color [7] =" #668899 "; color [8] = "#99 BBfA"; Color [9] = "# fECECC"; return Color [parseInt (Math. random () * 10)]; // random color .} // call several methods every three seconds to produce the function accrueChar () {// randomly place the random animation in the animation queue var _ sildeFun = [// put the animation to be executed into an array in sequence function () {$ ('# div1 div '). animate ({top: '+ = 470px'}, speed, function () {// Delete $ (this) when the animation is executed ). remove (); count-= 10; $ ("input [type = 'text']"). attr ({"value": c Ount}) ;};}]; // put the function group into the slideList animation queue $ ("# div1 "). queue ('slidelist', _ sildeFun); var _ takeStart = function () {// remove a queue function from the front end of the queue and execute it. $ ("# Div1 "). dequeue ("slideList") ;}; function randCharHandle () {randomChar (); _ takeStart () ;}randcharhandle () ;}// key code processing function keyCode (event) {var keyValue = event. keyCode; var flag = false; // alert (keyValue); for (var I = 0; I <= arrCode. length; I ++) {if (keyValue = arrCode [I] & $ ("#" + charArray [I] + ""). text ()! = "") {// Click the right button to stop a second $ ("#" + charArray [I] + ""). stop (1, 1000 ). remove (); // Add 10 points count + = 10 for the selected pair; $ ("input [type = 'text']"). attr ({"value": count}); $ ("# right "). text (keyRight); flag = true; break ;}} if (flag) {flag = false; keyRight ++; $ ("# right "). text (keyRight);} else {keyErro ++; $ ("# erro "). text (keyErro) ;}$ (function () {// acceleration $ ("input [value = 'acceleration ++ ']"). click (function () {if (speed> 0) speed-= 1000 ;}); // deceleration $ ("input [value = 'deceleration -- ']"). click (function () {speed + = 1000;}) ;}); window. setInterval ("accrueChar ()", 1500 ); /*************************************** ********************************** *****************/

  


I can use jquery to write a simple picture switching function. I'm a jquery newbie.

I wrote a jquery plug-in for you. You need to link the jquery plug-in first. In addition, set position: absolute
Var t = 1; $ (function () {len = $ ("# slideshow> ul> li "). length; $ ("# slideshow> ul> li "). hide (); // hide all $ ("# slideshow> ul> li "). eq (0 ). show (); // The first time = setInterval ("change ()", 3000) is displayed by default; // automatic playback every 3 seconds $ (". previous "). click (function () {// click the previous function clearInterval (time); $ ("# slideshow> ul> li "). fadeOut (); $ ("# slideshow> ul> li "). eq (t-2 ). fadeToggle (); t --; if (t = 0) {t = len;} time = setInterval ("change ()", 3000) ;}) $ (". next "). click (function () {// click the next function clearInterval (time); $ ("# slideshow> ul> li "). fadeOut (); $ ("# slideshow> ul> li "). eq (t ). fadeToggle (); t ++; if (t = len) {t = 0;} time = setInterval ("change ()", 3000 );})}) function change () {// automatic playback function if (t <len) {$ ("# slideshow> ul> li "). fadeOut (); $ ("# slideshow> ul> li "). eq (t ). fadeToggle (); t ++;} else {t = 0; $ ("# slideshow> ul> li "). fadeOut (); $ ("# slideshow> ul> li "). eq (t ). fadeToggle (); t ++ ;}}

Simple typing game software written in C #

After you use RANDOM to generate uppercase and lowercase characters, and then use the single-host keyboard event to cancel the characters, the font is fixed. The font whereabouts first ensure that your characters are displayed using the LABLE control, after a control is a thread, you just need to drop it to OK. Don't SLEEP (2000) too fast. I won't give you my half-products if you don't score anything.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.