var x = {
v : "",
w: function(){
怎么在这里调用v?
}
};
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> </head> <body> <script type="text/javascript"> var X = { x: "AAAA", W:function() { //调用的时候这样子写 alert(this.x); } }; X.W(); </script> </body> </html>
this代表对象x
this.v