HTML页面加载完成后执行的两种方法
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>title</title> <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script> <script type="text/javascript"> $(function () { console.log('aaa') }); </script> </head> <body> <script type="text/javascript"> $(document).ready(function () { console.log('bbb') }) </script> </body> </html>