If you have any questions, add the QQ group.14670545Discussion
The number of 18-bit cycles: datetime. Now. ticks. tostring ()
<SCRIPT type = "text/JavaScript"> // $ J = jquery. noconflict (); var time_begin = new date (); var settime = 3; var I; var showthis; $ (document ). ready (function () {for (I = 1; I <= settime; I ++) {setTimeout ("Update (" + I + ")", I * 1000) ;}}); function Update (Num) {If (num = settime) {$ ("# next_button "). ATTR ("disabled", false); $ ("# surplus_time "). text ("") ;}else {showthis = settime-num; $ ("# surplus_time "). text (showthis); $ ("# next_button "). ATTR ("disabled", true) ;}</SCRIPT>
The following is a specific example:
<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "pattern_memo.aspx.cs" inherits = "mywebsitetest. designpatterns. pattern_memo" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">
Public partial class pattern_memo: system. Web. UI. Page {protected void page_load (Object sender, eventargs e) {} protected void next_button_click (Object sender, eventargs e ){}}
Note that you must add a sentence after ready of the page.
$ ("# Next_button"). ATTR ("disabled", true );
Otherwise, the button will be available for about one second. If you add the enabled (disabled) attribute directly to the button, the onclientclick method will not work.
Compare the results: