Javascript notes and summaries (2-14) events

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.