javsscript代码的执行顺序
1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 7 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 8 <title>Document</title> 9 </head> 10 11 <body onload="ready()"> 12 <script> 13 window.onload = function () { 14 document.getElementById("btn").onclick = function () { 15 alert("hello js"); 16 } 17 } 18 </script> 19 <input type="button" value="按钮" id="btn"> 20 </body> 21 22 </html>