JS技巧
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript"> var i=10; while(i--) { alert(i); } var a=true; var b = false; var obj = { name: 'xiaoxiao', m1: function () { alert('m1'); } } obj.m1; alert(JSON.stringify(obj)); var i = 1; i = +i;alert(i); var test =''|| false; alert(test); alert(test); var array = [1,2,3]; len = array.length; i = i ? i < 0 ? Math.max(0, len + i) : i : 0; alert(i); var results = null; var ret = results || []; alert(ret.length); for (; i < 10; ) { alert(i); i++; } var ja = function () { alert('this is ja'); } ja.c = function () { alert('acccccc'); }; ja.pg = function () { alert('this is pg'); abc = 'this is abc00001'; return this.pg; }; // ja.pg() = function () { alert('this is pg()'); } //ja.pg().ac = function () { alert("this is ac"); return '01'; } ja.pg().title = 'this is title'; alert(ja.pg().title); alert(ja.pg.title+'static'); // alert(ja.pg['a01']); // alert(ja.pg()['a01']); // ja.pg().c = function () { alert('this is c1'); } // ja.pg().c(); // ja.pg().c = "ccc1"; // ja.pg()['ac'] = 'this is ac'; // alert(ja.pg()['ac']); // alert( ja.pg().c); </script> </head> <body> </body> </html>