拼接字符串
当每次输入的值(变量)不相同时 使用字符串拼接
jqery 取值 attr
添加到列表渲染到页面
渲染到页面
on的使用 在页面加载完成 不在解释页面后 ajax添加的内容绑定事件
---------------------------------------------------------------------------------------------------------------------------
1. js面向对象
function Func(name,age){
this.Name = name;
this.Age = age;
}
obj = new Func('root',18)
2. this关键字
# 每个函数中都有this
# 函数调用时,this=window
# 类new时, this=obj
function func(){
# 当做函数执行函数时,this=window
console.log(this);
}
func()
function Func(){
# 当做函数执行函数时,this=window
console.log(this);
}
obj = new Func()
3. js中无字典,只有对象
Name = 'alex'
obj = {
Name: 'root',
Age: 18,
Func: function(){
# this=obj
console.log(this.Name) # root
function inner(){
# this=window
console.log(this.Name)
}
inner() // 自执行函数 ( )( )
}
}
相当于new了对象 obj
obj.Func()