1. JavaScript 语言;
1.1 JS 如何运行?
<script src="test.js"></script> <a href="javascript:alert('aaaaa')">demo</a> <form action="javascript:alert('bbbbb');"> <input type="submit"> </form>
<div οnclick="alert('ccccc')">hello</div>
1.2 输出
alert();
document.write("characters");
1.3 变量与数据类型
JS 区分大小写;
变量是浏览器关闭之后才释放的;
JS是弱类型语言;
JS 的数据类型:1) number; 2) string; 3) boolean; 4) object; 5) undefined; 6) function
boolean: "", null, 0, 0.0都被认为是false;
1.4 运算符与表达式
位运算符: >>> 无符号右移
1.5 JS对象的声明与使用(摘自LAMP)
方法一:
//对象的声明
function Play(){
var p=new object();
//Properties
p.width=300;
p.height=200;
p.num=4;
p.autotime=3;
//Mehtod
p.autoplay=function(){
alert("play...");
}
p.test =function(){
}
return p;
}
//对象的实例化
var p=play();
方法二:
function Play(width,height, num){
this.width=width;
this.height=height;
this.num=num;
this.autoplay=function(){
}
this.test=function(){
}
}
//对象实例化
var p=new Play(300,200,5);
//对象的操作(for, with)
var pro="";
for(pro in p){
alert(p[pro]);
}
with(object){
所有方法都是object的方法;
}
docuemnt.write("<table>");
document.write("</table>");
with(document){
write("<table>");
write("</table>");
}
2. DOM;
3. JQuery: 用尽量少的代码完成尽可能多的功能,并解决了Browser兼容的问题;