jQuery的DOM操作

Original 2019-04-13 15:35:28 222
abstract:jQuery获取/改变CSSjQuery操作属性的方法jQuery事件方法jQuery事件切换:hover(over,out)鼠标移上效果和鼠标移出效果。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/

jQuery获取/改变CSS

jQuery操作属性的方法

jQuery事件方法

jQuery事件切换:hover(over,out)鼠标移上效果和鼠标移出效果。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<script type="text/javascript" src="jquery-3.4.0.min.js"> </script>
<style type="text/css">
div{width:200px;height:200px;border:1px solid #0F0}
</style>
<body>
<script type="text/javascript">
$(document).ready(function(){
  $('div').hover(
  function(){
  $(this).css('background','red')
  },
   function(){
  $(this).css('background','blue')
  }
  
  )
})

</script>
<div>我是内容</div>
</body>
</html>



Correcting teacher:天蓬老师Correction time:2019-04-13 16:38:36
Teacher's summary:在js中, this是谁, 一直是一个难点, 也是一个重点? 想一下, 在本例中, 它是谁, 其实就是上下文

Release Notes

Popular Entries