<html> <head> <mce:script language="javascript"><!-- for(var i=1;i<100;i++) { eval("var GetsHsCode"+i+"= new Array()"); eval("GetsHsCode"+i+"[0]=\"document.form.hscode"+i+"\"") eval("GetsHsCode"+i+"[1]=\"document.form.unitqua"+i+"\"") if(i==5)break; } alert(typeof(GetsHsCode1)) alert(GetsHsCode1[0]) alert(GetsHsCode1[1]) alert(typeof(GetsHsCode2)) alert(GetsHsCode2[0]) alert(GetsHsCode2[1]) // --></mce:script> /* 程序效果为动态生成99个数组,并将各个数组的第一和第二个元素赋值。这里只生成5个。。 如:var GetsHsCode1 = new Array(); GetsHsCode1[0] = "document.form.hscode1"; GetsHsCode1[1] = "document.form.unitqua1"; var GetsHsCode2 = new Array(); GetsHsCode2[0] = "document.form.hscode2"; GetsHsCode2[1] = "document.form.unitqua2"; */ </head> <body> </body> </html>
在JAVA SCRIPT中循环定义数组变量
最新推荐文章于 2023-04-22 12:43:39 发布