A simple js to extract random numbersSource code
I wrote an example of JS random number extraction. For your reference in the future.
SourceCodeAs follows:
<HTML> <br/> <pead> <br/> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "> <br/> <MCE: script language =" JavaScript "type =" text/JavaScript "> <! -- <Br/> var IDs = "1001,1002, 1003,1004, 1005,1006, 1007,1008, 1009"; // extract range, separated by commas (,). Here is the interface: you can use el to obtain the background input data <br/> var idsarr = IDs. split (","); <br/> var num = idsarr. length-1; // number of extracts <br/> var timer; // defines the timer </P> <p> Function Change () {<br/> document. getelementbyid ("expertid "). value = idsarr [getend (0, num)]; // quick conversion of extracted values <br/>}< br/> function startext () {<br/> clearinterval (timer); // cancel the timer <br/> timer = setinterval ('change () ', 10); // 10 (millisecond) the smaller the transformation interval, the faster the transformation <br/>}< br/> function endext () {<br/> clearinterval (timer ); // cancel the timer <br/>}< br/> function getend (Min, max) {<br/> return parseint (math. random () * (max-min + 1); // random extraction <br/>}</P> <p> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <Table> <br/> <tr> <br/> <TD align =" right "colspan =" 8 "> <br/> <input type =" button "value =" start to extract "onclick =" startext (); "Name =" button4 "> <br/> <input type =" text "id =" expertid "value =" "name =" expertid "style =" width: 150px; height: 70px; color: red; font-size: 70px; Border: 0px; Background: Background-color; border-left: none; border-Right: none; border-top: none; border-bottom: none; text-align: right; "readonly> <br/> <input type =" button "value =" stop extraction "onclick =" endext (); "Name =" button5 "> <br/> </TD> <br/> </tr> <br/> </table> <br/> </body> <br/> </ptml>
Run:
Source code: A simple JavaScript code for extracting random numbers.