返回jquery事......登陆

jquery事件

Love Never Dies.I Never Repent2019-01-03 13:14:48191

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>

<style type="text/css">

.box{

width: 300px;

height: 300px;

background: pink;

border-radius: 300px;

text-align: center;

line-height: 300px;

}

</style>

<script type="text/javascript">

$(document).ready(function(){

$(document).mouseover(function (aa){

$('span').text('坐标:'+aa.pageX+','+aa.pageY);

})

$('button').click(function(){

$('div').addClass('box');

$('div').mouseover(function(){

$(this).css('background','red');

$(this).html("<h2>添加h2标签</h2>")

$('div h2').css({'color' :'orange','font-size': '38px'});

})


})


})


</script>


</head>

<body>

<span></span>

<div></div>

<button>点击</button>

</body>

</html>

获取元素,然后.上事件名称,要执行的事件函数代码块!

最新手记推荐

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

全部回复(0)我要回复

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