我有这段代码,当我使用display
它不断给我的方法时:
网址未定义
名称未定义
描述未定义
我不知道为什么我会收到错误,即使我提供了所有的礼仪。有人可以帮我找出问题吗?
function website(name,url,description)
{
//Proparties
this.name=name;
this.url=url;
this.description=description;
// Methods
this.getName=getName;
this.getUrl=getUrl;
this.getDescription=getDescription;
this.display=display;
// GetName Method
function getName(name)
{
this.getName=name;
}
// GetUrl Method
function getUrl(url){
this.getUrl=url;
}
// getDescription
function getDescription(description){
this.getDescription=description;
}
function display(name,url,description){
alert("URL is :" +url +" Name Is :"+name+" description is: "+description);
}
}
// Set Object Proparites
web=new website("mywebsite","http://www.mywebsite.com","my nice website");
// Call Methods
var name = web.getName("mywebsite");
var url = web.getUrl("http://www.mywebsite.com");
var description = web.getDescription("my nice website");
web.display(name,url,description);