JavaScript学习(五)

jQuery

jQuery可以看做一个库,里面存在大量的JavaScript函数
JavaScript学习(五)_第1张图片

公式:$(选择器).事件(事件函数)




    
    Title
    
    
    
    



点我





选择器器

    //原生js,选择器少,麻烦不好记
    //标签
    document.getElementsByTagName();
    //id
    document.getElementById()
    //class
    document.getElementsByClassName();
    
    //jQuery css中的选择器它全部都能用!
    $('p').click();//标签选择器
    $('#id1').click();//id选择器
    $('.class1').click();//class选择器

文档工具站:http://jquery.cuishifeng.cn/

事件

鼠标事件,键盘事件,其他事件
JavaScript学习(五)_第2张图片




    
    Title
    
    




mouse:
在这里移动鼠标试试

鼠标移动就会产生相应的坐标
JavaScript学习(五)_第3张图片

操作DOM

节点文本操作




    
    Title
    





  • JavaScript
  • Python

JavaScript学习(五)_第4张图片

JavaScript学习(五)_第5张图片

css的操作 键值对的形式

 $('#test-ul li[name=python]').css({"color","red"})

元素的显示和隐藏: 本质 display : none;
``javascript
$('#test-ul li[name=python]').show()
$('#test-ul li[name=python]').hide()
```

你可能感兴趣的:(JavaScript学习(五))