A sentence JS to help you kill, snapping

Source: Internet
Author: User

Just saw a buddy wrote a jquery plugin countdown-buy seconds kill suddenly think of an idea is title

Idea: Now many places have similar seconds to kill, snapping, such as speed, speed (in fact, the server slag, such as: a meter), many people think can write a client, open has been brush,

I think I should be able to directly through the JS code to execute. Get down to the chase.

If you know and will use the browser developer tools is very good to do, I used to use chrome, this example also use Chrome

F12 Open Developer Tools

In the console directly input JS band can be executed, so we should have a clue

Test:

Write a test page

< Div >    <  > time:<id= "SPView"></  span></div></div> 

Corresponding JS

$(function() {    varOutime = 30; varView = $ ("#spView"); varInterval = SetInterval (function() {outime--; if(Outime = = 0) {clearinterval (interval); View.html (""); varBTN = $ ("<input type= ' button ' value= ' Open Rob '/>");            View.append (BTN); Btn.on ("Click",function() {alert ("I Rob!");        }); } Else{view.html (outime); }    }, 1000);});

This is a very simple countdown, 30 seconds after the countdown to give the "Rob" button

Then we can build our own snapped JS.

Directly on the code

SetInterval (function  () {    var txt= $ ("#spView"). html ();     if (IsNaN (TXT)) {  // This decision can be determined according to the status of the page, determine whether you can start snapping       // execute the corresponding button event      1000);    

This time you only need to copy this code, and then in the snapping page F12 in the console paste this code, and enter the execution

This solution is simple, regardless of post content

But you have to log in to the system first.

A sentence JS to help you kill, snapping

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.