Home > Web Front-end > JS Tutorial > body text

Comment on 4 ways to asynchronously load js_javascript skills

WBOY
Release: 2016-05-16 15:24:10
Original
1211 people have browsed it

4 ways to asynchronously load js, the review begins.

Option 1: $(document).ready

<!DOCTYPE html>
<html>
    <head>
        <script src="http://common.cnblogs.com/script/jquery.js" type="text/javascript"></script> 
        <script type="text/javascript">
            $(document).ready(function() {
              alert("加载完成!");
            });
        </script>
    </head>
    <body>
        <img src="http://images.cnitblog.com/i/121863/201405/222202573569862.jpg" />
    </body>
</html>
Copy after login

Comments:

1. Need to quote jquery

2. Compatible with all browsers.

Option 2:

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!