JavaScript基本操作

element=document.getElementById("demo") //查找元素
element.innerHTML="Hello JavaScript"; //改变内容
element.value="Hello JavaScript";


对象(Object)字面量 定义一个对象:
var person={firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}
var cars=new Array();
cars[0]="Saab";
cars[1]="Volvo";
cars[2]="BMW";
var cars=new Array("Saab","Volvo","BMW");
var cars=["Saab","Volvo","BMW"];


获取元素属性值:$('#RecallFlag_1').attr('checked');
元素属性值赋值:$('#RecallFlag_1').attr('disabled', true);

posted @ 2017-11-02 10:36  HuSam  阅读(217)  评论(0编辑  收藏  举报