html页面加载时执行的方法
    html代码:
<html> 
<head> 
	<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script> </head> 
<body> 
	<input type="button" id="btn"/> 
</body> 
</html> 
<script   type="text/javascript">
$(function(){ 
	        alert("加载时执行");
  $("#btn").click(function(){//绑定事件 
    alert("load test!");
  }); 
}); 
</script>--------------------------------------------------------------------------------------------------------------
加载页面时执行方法写法:
1、$(function(){ 
  $("#btn").click(function(){ 
    //adding your code here 
  }); 
}); 
2、$(document).ready(function(){ 
  $("#btn").click(function(){ 
    //adding your code here   
  }); 
}); 
3、window.onload = function(){ 
  $("#btn").click(function(){ 
    //adding your code here 
  }); 
}