创建自己的对象
时间:2007-12-27 来源:不详 作者:林子
function pastaToString()
{
//
返回对象的属性。
return "Grain: " this.grain ""
"Width: " this.width ""
"Shape: " this.shape ""
"Egg?: " Boolean(this.hasEgg);
}
var spaghetti = new pasta("wheat", 0.2, "circle", true);
//
将调用 toString()
并显示 spaghetti
对象
//
的属性(需要Internet
浏览器)。
window.alert(spaghetti);
织梦内容管理系统
上一篇:Jscript 保留字 下一篇:内部对象
文章评论
共有位Admini5网友发表了评论 查看完整内容