不好意思, 一直没看到! 我建议你把服务器端的ASP代码与客户端自定义构造对象相结合:
<SCRIPT LANGUAGE="JavaScript">
function mainFunction()
{
this.items = new Array()
this.add = function(e)
{
this.items[this.items.length] = e;
}
this.toString = function()
{
var str = "";
for(var i=0; i<this.items.length; i++)
str += this.items[i].toString();
return str;
}
}
function mainFunctionItem()
{
this.s1 = ""; //定义六个私有变量
this.s2 = "";
this.s3 = "";
this.s4 = "";
this.s5 = "";
this.s6 = "";
this.toString = function()
{
var str = "<div style='color: red'>";
str += " s1 = "+ this.s1;
str += " s2 = "+ this.s2;
str += " s3 = "+ this.s3;
str += " s4 = "+ this.s4;
str += " s5 = "+ this.s5;
str += " s6 = "+ this.s6;
str += "</div>";
return str;
}
}
</script><SCRIPT LANGUAGE="JavaScript">
var a = new mainFunction();//你可以在服务器端用 for 循环生成下面这段JS代码:)
var b = new mainFunctionItem();
b.s1 = "1";
b.s2 = "1";
b.s3 = "1";
b.s4 = "1";
b.s5 = "1";
b.s6 = "1";
a.add(b);var b = new mainFunctionItem();
b.s1 = "2";
b.s2 = "2";
b.s3 = "2";
b.s4 = "2";
b.s5 = "2";
b.s6 = "2";
a.add(b);var b = new mainFunctionItem();
b.s1 = "3";
b.s2 = "3";
b.s3 = "3";
b.s4 = "3";
b.s5 = "3";
b.s6 = "3";
a.add(b);
document.write(a);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function mainFunction()
{
this.items = new Array()
this.add = function(e)
{
this.items[this.items.length] = e;
}
this.toString = function()
{
var str = "";
for(var i=0; i<this.items.length; i++)
str += this.items[i].toString();
return str;
}
}
function mainFunctionItem()
{
this.s1 = ""; //定义六个私有变量
this.s2 = "";
this.s3 = "";
this.s4 = "";
this.s5 = "";
this.s6 = "";
this.toString = function()
{
var str = "<div style='color: red'>";
str += " s1 = "+ this.s1;
str += " s2 = "+ this.s2;
str += " s3 = "+ this.s3;
str += " s4 = "+ this.s4;
str += " s5 = "+ this.s5;
str += " s6 = "+ this.s6;
str += "</div>";
return str;
}
}
</script><SCRIPT LANGUAGE="JavaScript">
var a = new mainFunction();//你可以在服务器端用 for 循环生成下面这段JS代码:)
var b = new mainFunctionItem();
b.s1 = "1";
b.s2 = "1";
b.s3 = "1";
b.s4 = "1";
b.s5 = "1";
b.s6 = "1";
a.add(b);var b = new mainFunctionItem();
b.s1 = "2";
b.s2 = "2";
b.s3 = "2";
b.s4 = "2";
b.s5 = "2";
b.s6 = "2";
a.add(b);var b = new mainFunctionItem();
b.s1 = "3";
b.s2 = "3";
b.s3 = "3";
b.s4 = "3";
b.s5 = "3";
b.s6 = "3";
a.add(b);
document.write(a);
</SCRIPT>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货