一、javascript
1 $(function(){ 2 $("#a").click(function(){ 3 //adding your code here 4 }); 5 });
二、java
1 $(document).ready(function(){ 2 $("#a").click(function(){ 3 //adding your code here 4 }); 5 });
三、jquery
1 window.onload = function(){ 2 $("#a").click(function(){ 3 //adding your code here 4 }); 5 }
四、判斷頁面是否加載完成spa
1 <script type="text/javascript" language="JavaScript"> 2 3 //: 判斷網頁是否加載完成 4 document.onreadystatechange = function () { 5 if(document.readyState=="complete") { 6 alert('ok'); 7 } 8 } 9 10 </script>