Polling (Polling) is a way for a CPU decision to provide peripheral device services, also known as "programmed output in" (Programmed I/O). The concept of polling is that the CPU timed to ask, in sequence to ask each of the peripheral devices need their services, there is to give services, after the end of the service to ask the next perimeter, and then continue to cycle. The polling method is easy to implement, but less efficient.
In JavaScript using the SetInterval function for a simple polling operation, you can determine the value of a parameter at any time, but do not have to refresh the page, that is, do not add <meta http-equiv= "Refresh" content= "5" in the header > Make a decision to refresh the page.
I. BASIC OBJECTIVES
An input box without the onchange () function, directly using the SetInterval function as a simple polling operation, not 0.5 seconds to read the contents of the text box
In fact, the same principle as the JavaScript clock, every second to take the current time, and then update the text content
Second, the production process
The code below, no longer repeat:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
The polling () function begins execution after the page is loaded, executes the synchronous () function, and then executes the synchronous () once every 0.5 seconds;"JavaScript" uses the SetInterval () function as a simple polling operation