全仔-->js
Javascript
1.事件处理
Onclick
Onerror
Onload
Onmouseover
Onmouseout
Onsubmit
2.布尔值(true/false)
3.x+=y(x=x+y)
4.
.move(class类)可多次使用
<span class=”move”></span>
#name(id)唯一使用
<span id=”name”></span>
5.redirection重定向
6.h1…h6标题大小
7.head script && body script
8.document.getElementById(“idname”).innerHTML=”需要输入的内容”;
9.function a(){
xx;
}
windows.onload = a;//把a赋值给事件,当事件发生时处理程序
a();//调用函数a
10.<noscript></noscript>//在不支持javascript的浏览器显示提示信息
11.
a)alert
alert(“内容”);
b)confirm
if(confirm(“内容”)){
xx;
}else{
xx;
}
c)prompt
var ans = prompt(“内容”,”默认答案”);
if(ans){
xx;
}else{
Xx;
}
12.(condition) ? truePart : falsePart
13.对象探测
14.<a href = “script.html” id=”redirect”>welcome!!</a>
Document.getElementById(“redirect”).onclick=init;
Function init(){
windows.location=”jsweclome.html”;
}//如果浏览器支持js转到页面jsweclome.html,否则转到script.html
15.document.referrer前页
16.Math.floor(Math.random()*75)+1;
//Math.floor取整
// Math.random随机产生0~1的数
17.数组
Var colPlace=new Array(0,1,2,3,4);
使用:colPlace[x]
18.switch/case
19.isNaN(ans)//判断ans是否数字
20.docunment.images[i].parentNode.tarName==”A”
// parentNode父容器,tarName对象名称,A<a></a>标签
21.