function Oggetto(){
this.nome="Antonello";
this.cognome="Iaccarino";
this.StampaNome=function(){
alert(this.nome + " " + this.cognome);
}
}
var Istanza=new Oggetto();
Istanza.StampaNome();
Funziona egregiamente!
Per meglio copiare e incollare i risultati, invece di alert uso document.write.
function Oggetto(){
this.nome="Antonello";
this.cognome="Iaccarino";
this.StampaNome=function(){
document.write(this.nome + " " + this.cognome);
}
}
var Istanza=new Oggetto();
Istanza.StampaNome();
Antonello Iaccarino
Nessun commento:
Posta un commento