1.HTML是一种处理文档结构的标记语言,CSS(层叠样式表)控制文档元素的位置和外观。HTML和CSS能控制Web页面如何构建和显示。
2.JavaScript是脚本语言,能够动态为Web页面增加行为。所有的浏览器都提供了一个内置的JavaScript解释器。<script>
3.jQuery是一个比较好用的JavaScript库。
4.HTML文档对象模型(DOM)构建了Web页面。
5.JavaScript解释器并不改变原来HTML和CSS文件,它只是改变浏览器内存页面的DOM表示。
6.jQuery函数:jQuery(),简写$()。
7.jQuery选择元素的方式与CSS完全相同:
元素选择器: $(“h1”).hide();
类选择器:$(".my_class").slideUp();
ID选择器:$("#my_id").fadeOut();
8. display:none; 隐藏元素
display:block; 显示元素
9.$("#my_id").fadeIn() $("#my_id").fadeOut() 淡入淡出
$("#my_id").slideUp() $("#my_id").slideDown() $("#my_id").slideToggle() 滑入滑出
10. 先建立结构和样式,再添加脚本。最灵活、最有用的HTML元素是<div>盒子模型。
11.<script>标记放到最下面,有助于提高页面加载速度。
12.生成随机数:var num =Math.floor(Math.random()*n);
13.$(this) 返回当前元素。
14.$("").append(); $("").remove();
15.绑定事件两种方式:
$("my").click (function(){
alert($(this).text());
});
$("my").bind ('click',function(){
alert($(this).text());
});
.unbind() 删除绑定事件
16.选择器 + 事件 + 函数 = 复杂的交互
17.遍历所有元素(动作) $(".my").each(function(){});
18. 函数声明和函数表达式
function name (){}
var myfunction = function (){}
可以向函数传递参数,函数可以返回值:返回类型可以是数值、文本甚至是DOM元素
19.jQuery 静态方法$.contains
20.
$().parent() 父元素; $().childen()子元素 ;
$().prev() $().next;
$().parent().parent() ; $().parent().parent().remove();
21.$().parent().parent().detach() 删除,还可以找回来(恢复);
22. $f = $().parent().parent().detach() 存储元素
23.$().replaceWith();
24.在DOM中插入HTML :$().before() $().after();
25.$("").fadeIn().fadeOut(). $("").animate({left:"+=100px"},500);
26.需要存储关于一个特定事物的多个数据时可以使用对象:
var myCountry = {
getCapital : function (){
alert(this.myCapital);
},
myName:"USA",
myCapital:"dc"
}
27. function my (a,b){
this.name = a;
this.age = b;
}
28.使用方法 $.inArray(value,array)
29.清空数组最便捷的方法:array.length=0;
30.window是JS世界中最高层次的对象。
它的属性:window.name,window.history,window.document, window.onfocus, window.onblur
它的方法:window.setTimeout(); window.clearTimeout(); window.setInterval();window.clearInterval();
window.setTimeout(function,400);
window.setInterval(repeatMe,1000);
slideDown().delay(5000).slideUp();
31.CSS3新增特性:
transition:1s; ——从一个样式过渡到一个样式,有一个平滑的效果;
display:flex;——弹性盒模型;
32.定位
position:relative;——相对定位,相对于没有定位前的位置,相对定位对元素本身没有影响
position:absolute;——绝对定位,相对于父级元素定位,会使元素支持 宽 高,脱离文档流(在页面中没有占用位置)。
33.3D
transform:rotateY(60deg);——旋转60度;
perspective:1000px;——景深1000px;
34.$(function(){……})是$(document).ready(function(){……})函数的简写。