可以改成这样
function star(photo,name,age,sex,like){
     this.photo=photo
     this.name=name
     this.age=age
     this.sex=sex
     this.like=like
     }
function showit(obj){
 var displayit;
 for ( i in obj)
    if(i!=name)   displayit += obj[i]+"<br>";
        else  displayit += "姓名"+obj[i]+"<br>";
document.writeln(displayit);
}star1=new star(...);
star2=new star(...);
showit(star1);
showit(star2);
不知道行不行。