Common events:
onclick element when clicked
When the onfocus element gets focus
When the onblur element loses focus
onmouseover when the mouse is over
OnSubmit when the form is submitted (<form onsubmit= "return func ();" ></form>)
When the onload page finishes loading
Note: onsubmit = "return func ()"; The Func () function can block the result of the submission.
Disadvantages of the "example" onload:
img.php, used to display pictures, here let the picture output after 5 seconds
<? PHP $img // Create a black square with a * px Sleep // output after 5 seconds Header ("Content-type:image/png"); Imagepng ($img);
Test.html, referencing a picture while using the OnLoad event to change the text effect
<! DOCTYPE html>function t () { document.getElementById ("P"). Style.fontweight = "bold"; } </script>
When you visit test.html, the page displays:
After 5 seconds:
Conclusion: The OnLoad event must be executed only after all elements of the site, such as SRC references, are loaded, whether this station or the external station.
Attached: Sublime (Text2 | TEST3) Shortcut keys:
① Input:
P>input:text
Press TAB to get:
<p><input type="text" name= "id=""></p>
② Input:
p*2>input:text
Press TAB to get:
<p><input type="text" name= "" id="" ></p><p ><input type="text" name= "id=""></p>
Javascript notes and summaries (2-14) events