返回jQuery基......登陆

jQuery基础语法

何和和。2018-11-06 10:10:02223
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript"src="jquery-3.3.1.min.js"></script>
<script>
$(document).ready(function(){
	$(".width").click(function(){
    $("div").width(200);
  });
	$(".height").click(function(){
    $("div").height(200);
  });
	// $(".color").click(function(){
 //    $("div").color("pink");
 //  });
  	$(".hide").click(function(){
    $("div").hide();
  });
  $(".show").click(function(){
    $("div").show();
  });
});
</script>
</head>
<body>
<div style="width: 100px;height: 100px;background: red;"></div><br>
<button class="width">变宽</button>
<button class="height">变高</button>
<!-- <button class="color">变色</button> -->
<button class="hide">隐藏</button>
<button class="show">显示</button>
</body>
</html>

把之前JavaScript的案例拿过来试了一下,除了变色没办法改变,其他的都可以做到。

最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送