JQ的简单使用(基础)——————JQ

JQ基础——JQ的简单使用

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style>
			.w{}
		</style>
	</head>
	<script type="text/javascript" src="js/jquery.min.js" ></script>
	<body>
	1.	弹窗
		<script>
			$(function(){
				alert("JQ超简")
			})
		</script>
	2.	修改文本
		<div>张山</div>
		<script>
			$(function(){
				$("div").html("李四")
			})
		</script>
			
	3.	点击事件
		<button id="btn">点我</button>
		<script>
			$(function(){
				$("#btn").click(function(){
					$("#btn").html("修改成功")
				});
			});		
		</script>
	4.图片显示/隐藏  (自建效果)
	<img src="img/bootstrap-mdo-sfmoma-01.jpg" id="img" width="200px"> <br />
	<button id="btn1">显示</button><button id="btn2">隐藏</button>
<a href="#" id="btn1">显示</a><a href="#" id="btn2">隐藏</a>
	<script>
		$(function(){
			$("#btn1").click(function(){
				$("#img").show(2000);
				$("#img").fadeOut(2000);//渐出
				$("#img").slideDown(2000);//向下出
				
			});
		});
		$(function(){
			$("#btn2").click(function(){
				$("#img").hide(2000);
				$("#img").fadeIn(2000);//渐入
				$("#img").slideUp(2000);//下上藏
			})
		})
		自建效果
		$(function(){
			$("#btn1").click(function(){
			$("#img").animate({
				width: "400px",
				opacity:"0.1" ,
			},3000)
		})
	})
	</script>
	5.Ad广告。定时弹出。
	<img src="img/bootstrap-mdo-sfmoma-01.jpg" id="img" />
	<script>
		$(function(){
			setTimeout("hideAd()",3000);
		});
		function showAd(){
			$("#img").show();
			
		}
		function hideAd(){
			$("#img").hide();
			setTimeout("showAd()",3000);
		}
	</script>
	</body>
</html>

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值