Blogger Information
Blog 18
fans 0
comment 0
visits 14895
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
js学习笔记
牛粪也香的博客
Original
712 people have browsed it

function func(){

  var a=123;

 alert(a);

}

alert(func());

function func1(){

  var a=123;

  alert(a);

  return "aaa";

}

alert(func1());

if(){

}else{

}

var age=50;

if(age <=20){

 alert("小");

}else if( age>20 && age <40){

 alert("中");

}else{

   alert("大");

}

 switch(val){

 case 1:

 alert("aaa");

 break;

 case 2:

 alert("bbbb");

 break;

}

循环

var num=10;

for(i=0;i<num;i++){

 alert('i='+ i);

}

var num=5;

while (num<10){

 alert('i='+ num);

 num++;

}

//先循环一次再判断

var num=11;

do{

 alert("num="+num);

 num++;

}while( num<10)

//转成整数

var num='11.2';

num=parseInt(num);

alert(num);//NaN NOT A NUMBER转换失败

if(isNaN(num)){//判断是否是num,若是不是,就转换失败

 alert("转失败");

}

arr.push 添加一个
arr.pop 从最后删除一个

arr.shift() 从前面,删除一个
arr.unshift()从前面增加一个

arr.splice(#,#) #从第几个开始,#删除几个数

arr.indexOf(searchvalue,fromindex)
 

arr.indexOf(value,0),从第0个开始找,找相关的value
若没有找到,就返回-1 关键值 -1 


var arr=[1,3,5,7,9]

for(i=0;i<=arr.length,i++){
    console.log(arr[i]);

var i=0;
while(i<=arr.length){
   console.log(arr[i]);
   i++;
}
直接跳转
window.loaction.href='http://www.baidu.com';
打开新窗口(容易被拦截)
window.open('http://www.baidu.com');

onmouseover="func()"; 鼠标移动到上面就触发一个函数
onmouseleave="func1()";鼠标移走执行事件

onblur="checks()";当控件失去焦点在时候触发

onchange="change()";当值改蛮的时候触发,多级联动


Correction status:qualified

Teacher's comments:要坚持
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post