document.ready

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<!-- 引入 jQuery -->
<script src="scripts/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
//等待dom元素加载完毕. $(document).ready(function(){
alert("Hello World!");
});

//test2
$(document).ready(function(){
alert("Hello again!");
});
</script>
</head>
<body>
</body>
</html>

你可能感兴趣的:(JavaScript,html,jquery)