实例
/* <head> <title>jQuery</title> <!-- 第一种引入方式 --> <script type="text/javascript" src="../js/jquery-3.3.1.js"></script> <!-- 第二种 --> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> </head> 引入之后就是加载 简写形式 <script type="text/javascript"> $(function(){ alert(加载完毕:第1种) }) </script> 非简写 <script type="text/javascript"> $(document).ready(function(){ alert(加载完毕:第2种) }); </script> 在把原生的写上对比一下吧 <script type="text/javascript"> window.onload(function(){ alert('原生加载') }) </script> --> 实例 --> -->*/ <!DOCTYPE html> <html> <head> <title>jQuery</title> <!-- 第一种引入方式 --> <!-- <script type="text/javascript" src="../js/jquery-3.3.1.js"></script> --> <!-- 第二种 --> <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ alert('加载完毕...') }) </script> </head> <body> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例