好象不对吧,javascript支持二维数组吗?如果你再想通过button来传递参数
不如在按钮中加个参数例如:
<input type=button onclick="abc(5,5)"><script>
function abc(totalNum,acctlist)
{
for(i = 0; i < totalNum; i++)
{
document.write("<tr>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + (i+1)+ "</div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + acctlist[i][0] + "</div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + acctlist[i][1] + "</div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'></div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + acctlist[i][2] + "</div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + acctlist[i][3] + "</div></td>");
document.write("</tr>");
}
}
</script>
不如在按钮中加个参数例如:
<input type=button onclick="abc(5,5)"><script>
function abc(totalNum,acctlist)
{
for(i = 0; i < totalNum; i++)
{
document.write("<tr>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + (i+1)+ "</div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + acctlist[i][0] + "</div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + acctlist[i][1] + "</div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'></div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + acctlist[i][2] + "</div></td>");
document.write(" <td class='getTableTD1' nowrap> <div align='center'>" + acctlist[i][3] + "</div></td>");
document.write("</tr>");
}
}
</script>
解决方案 »
- js中的var a = new A;与var a = new A();有什么区别?
- setInterval()会使得已经调用的This改变指向吗?
- 怎么判断输入中有“*”和“/”,这两个字符
- 关于javascript格式化字符串问题
- 帮忙看下这段漂浮图片代码
- 关于操作iframe显示“存取被拒”
- Ascii码与UniCode码之间的关系
- 怎么取到复选框对应的文本框
- 怎么将SQL的查询结果转为JSON并传到HTML页
- Echarts数据可视化
- 如何循环读取文本文件的一行,直到结束?
- 谁知道像这网站里会伸缩的栏目树形导航是怎么做的 http://www.ie-china.com/Photo/Index.html
,生成的叶面只有document.write中的这些html代码了阿