![]() |
#2
coutprintf2019-05-10 17:57
|

<html>
<body>
<script type="text/javascript">
var i;
function user()
{
this.name = new Array();
}
user.prototype.getname() = function () {
this.name[0]=prompt("enter your group name"," ");
this.name[1]=prompt("enter your group name"," ");
this.name[2]=prompt("enter your group name"," ");
this.name[3]=prompt("enter your group name"," ");
for(i=0;i<4;i++)
{while(this.name[i]==" ")
{
this.name[i]=prompt("enter your group name"," ");
}
}
}
user.prototype.setname()=function(){
for(i=0;i<4;i++)
document.write(this.name[i]);
}
var a=new user();
a.getname();
a.setname();
</script>
</body>
</html>
<body>
<script type="text/javascript">
var i;
function user()
{
this.name = new Array();
}
user.prototype.getname() = function () {
this.name[0]=prompt("enter your group name"," ");
this.name[1]=prompt("enter your group name"," ");
this.name[2]=prompt("enter your group name"," ");
this.name[3]=prompt("enter your group name"," ");
for(i=0;i<4;i++)
{while(this.name[i]==" ")
{
this.name[i]=prompt("enter your group name"," ");
}
}
}
user.prototype.setname()=function(){
for(i=0;i<4;i++)
document.write(this.name[i]);
}
var a=new user();
a.getname();
a.setname();
</script>
</body>
</html>