Before the page is loaded, some information will be output
< ;/html>
After execution, it is indeed "information is output before the page is loaded." 2. In the following example, document.getElementById will be empty. My plan is: when the page loads, the data processed by the background is displayed in the text box of
, such as the string "hello, my friend!" here. But what is read here through document.getElementById is that the object is empty. Because the onLoad method is executed before the page is loaded, the text box corresponding to the text box with id="mes" has not yet been loaded.
3. Solution When loading an Html web page, all data in will be loaded. Load first, then .
So we can just write javascript after and before . The program is executed sequentially and can be executed until the corresponding javascript call is executed. Not using the onLoad method. The code is as follows:
t. value="hello, my friend!" } showMessage(); //Call the method and update the text box
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn