window.onload = function () {
//json中的function中的this隻json對象本身
var json = { name: 'abc', age: 12, fn: function () { return this.name; } };
alert(arr[0].name);
}
js操作屬性的方法
1.txt1.value='111';
2.txt1['value']='111';
第二種特别用法
function settext(name)
{
txt1[name]='111';
}
3.dom
getattribute(名稱)
setattribute(名稱,值)
removeattribute(名稱)
//阻止右鍵菜單
document.oncontextmenu = function () {
return false;
};
offset屬性在運動架構中border的bug
clientx,clienty是可視視窗的坐标位置加scrolltop scrollleft