function hex(x,y,side,isLast,color) {//Hex object constructor. this.x = x; this.y = y; this.side = side; this.isLast = isLast; this.color = color; function multiply() { return this.x * this.y; } this.multiply = multiply; } var hexagon = new hex(22,22,20,0,1); document.write(hexagon.multiply);
當加載的index.htm,結果反而在屏幕上寫的返回值的函數:的Javascript顯示功能文本,而不是打印值在屏幕上
功能乘法(){返回this.x * this.y; }
:(
哈!太簡單。丹科! – 2009-12-05 20:55:20
De nada! (從姓氏中猜測語言環境 - 如果我錯了,請原諒我) – 2009-12-05 21:07:03