//json格式的类
var j = ‘obj = { Server:"192.168.2.160",Port:"10000",Url: function (){return this.Server + ":" + this.Port;}} ‘;
var jc = eval(j); //转换为对象
jc.Port = "111";
alert(jc.Url());
//定义的其他格式类也一样可以 eval(string)转换
时间: 2024-10-08 07:28:37
//json格式的类
var j = ‘obj = { Server:"192.168.2.160",Port:"10000",Url: function (){return this.Server + ":" + this.Port;}} ‘;
var jc = eval(j); //转换为对象
jc.Port = "111";
alert(jc.Url());
//定义的其他格式类也一样可以 eval(string)转换