首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

javascript的函数传值有关问题

2012-09-09 
javascript的函数传值问题想做一个函数abc(a,b,c)能用var fnew abc()f.aasdfasdf.basdfasdf.cfasdf将a

javascript的函数传值问题
想做一个函数abc(a,b,c)
能用var f=new abc()
f.a=asdfasd
f.b=asdfasd
f.c=fasdf
将abc值写到网页里,如何做?

[解决办法]

JScript code
      function abc(a, b, c) {          this.a = a; this.b = b; this.c = c;          this.toString = function () { return this.a + '<br/>' + this.b + '<br/>' + this.c; }      }      var f = new abc();      f.a = 'a'; f.b = 'b'; f.c = 'c';      document.write(f.toString()) 

热点排行
Bad Request.