Blogger Information
Blog 27
fans 2
comment 1
visits 13629
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
jquery的二种引入方式与$(document).ready() 2018年4月2日
kaclod的博客
Original
763 people have browsed it

第一种导入方式本地导入:

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>jquery的导入</title>
	<script type="text/javascript" src ="js/jquery-3.3.1.js"></script>
</head>
<body>
	<h1>点击导入</h1>
	<P>本地jquery导入</P>
	<script type="text/javascript">
		$('h1').click(function() {
			alert('www.php.cn')
		})
	</script>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

二:网络导入的方法:

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>在线导入jquery</title>
	<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
	<h1>点击导入</h1>
	<script type="text/javascript">
		$('h1').click(function() {
			alert('www.php.cn')
		})
	</script>

	<p>第二种导入方式</p>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

$(document).ready()的使用方式与简写:

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>$(document).ready()使用方式与简写</title>
</head>
<script type="text/javascript" src="js/jquery-3.3.1.js"></script>

<body>

<p>当dom对象加载,并且页面完全呈现的时候发生ready事件</p>
<pre>
	方式1 :$(document).ready(function{

})


	方式二:$().ready(function(){

})


	方式三: $(function(){

})
</pre>
	
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post