JavaScript Simulation for keyboard typing _ javascript skills

Source: Internet
Author: User
This article mainly introduces how to simulate and implement keyboard typing using JavaScript. This article provides the example code directly. For more information, see
$ (Function () {var input_type = {init: function ($ obj) {this. name = export obj.html (). split ("") this. length = this. name. length; this. I = 0 ;}, pri: function () {var $ this = this // only closures can be used here, because wn. settimeout points this of the function to the object unknown wn, rather than the this object of the prototype chain. Now I need recursion, so I can only upload this object to the closure, recursively returning the anonymous closure function. Return (function () {if ($ this. i> $ this. length) {window. clearTimeout (Go) return false;} var char = $ this. name $ (". p1 "). append (char [$ this. i]) $ this. I ++ var Go = window. setTimeout (arguments. callee, 100) // here arguments. callee is an anonymous closure that calls the function itself. }) }}// Create the class function Input_type () {this. init. apply (this, arguments)} Input_type.prototype = input_type // create an instance var p = new Input_type ($ (". content ") p. pri ()()});

To achieve the interval of each loop, use window. settimeout recursion. This conflict occurs because you want to encapsulate it with the prototype chain, so you can call the anonymous closure function recursively. Use arguments. callee to represent anonymous functions.

HTML code:

Pri

My father and I have not met each other for more than two years. What I cannot forget is his background. In the winter of that year, my grandmother died, and my father's bad fortune was also lost. It was the day when I went from Beijing to Xuzhou and planned to go home with my father. When I saw my father in Xuzhou, I saw a mess in the courtyard and remembered my grandmother. I couldn't help but shed tears. My father said, "This is already the case, so you don't have to worry about it. Fortunately, there is no path to death !" When I went home to sell the goods, my father suffered a loss and borrowed money to do the funeral. In these days, the light scene in the family is very bleak, half for funeral, half for Father idle. After the funeral is over, my father will go to Nanjing to seek advice. I will go back to Beijing to study, and we will walk with me. When I arrived in Nanjing, some friends made a visit and stayed for a day. On the morning of the next day, they had to cross the river to pukou and get on the bus to the north in the afternoon. My father told me that he would not send me because he was busy. He told me to accompany me with a well-known Tea House in the hotel. He repeatedly told the tea room carefully. But at last he was not at ease, fearing that the tea room would not be proper; he hesitated for a while. In fact, I was 20 years old and had been in Beijing for two or three times. It doesn't matter. After a while, he finally decided to let me go. I tried to persuade him not to go in two or three times. He only said, "It doesn't matter. They can't go well !" We crossed the river and entered the station. I bought a ticket and he was busy looking after his luggage. There are too many luggage. You have to tip your husband to pass. He was busy talking to them about the price. At that time, I was so intelligent that I always felt that he was not very beautiful and he could not intercept himself. But he finally decided on the price and sent me to the bus. He picked a chair by the door for me, And I made his purple coat for me to fill the seat. He told me to be careful on the road and stay alert at night. I also asked the tea room to take care of me. I smiled at his secret in my heart; they only recognize the money, so they are white trust! In addition, can't I cook myself as a person of my age? Alas, I think about it now. It was so clever! I said, "Dad, let's go ." He looked out and said, "I want to buy some oranges. You are here, don't move around ." I think there are a few sellers waiting for customers outside the fence of the platform. When I walked over the platform, I had to go through the railway. I had to jump down and climb up again. My father is a fat man. It takes some trouble to go over. I was supposed to go. He refused, so he had to go. I saw him wearing a black cloth, a big horse, a dark blue cloth, and a cotton gown. he stumbled over to the railway and slowly leaned over. However, it is not easy for him to climb the platform over the railway. He climbed his hands up and his feet up and down; his obese body leaned down to the left, showing the effort. At this moment I saw his back, my tears quickly shed. I quickly wiped my tears for fear of seeing them, and for fear of seeing others. When I looked out, he looked back with a red orange. When he crossed the railway, he first dispersed the oranges on the ground, slowly climbed down, and then picked up the oranges. When I got here, I had to pick him up. He and I went to the car and put the oranges in my fur coat. As a result, I was very relaxed and said, "I'm leaving. Send a letter there !" I watched him go out. He took a few steps and looked back at me and said, "Go in, no one is in ." When his back is mixed into the people who come and go, I can't find it. Then I come in and sit down, and my tears come again. In the past few years, my father and I have both traveled east and west, and the scenery in my family is not as good as a day. He went out to earn a living and supported him independently. He did many things. The old world is so poor! He was so sad that he could not feel himself. Feeling depressed in the middle, naturally to the outside; Family Xiao often touch his anger. He gradually moved on to me. But in the last two years, he finally forgot about my bad habits, but missed me and my son. After I arrived in North China, he wrote a letter to me, saying, "I am safe, but my arm hurts, and I have to give up my pen. it is inconvenient. It is not long before I go ." I read that, in the tears of the crystal clear, I saw the obese, blue cloth, cotton gown, and the back of the black cloth. Alas! I don't know when to meet him again!

Related Article

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.