如何将下面语句简化,写成循环(有100条)
<tr height="24" width="200">
<td align="center"><a href="####" onclick="test(1)">1</a></td>
........
<td align="center"><a href="####" onclick="test(10)">10</a></td>
</tr>
....................................
<tr height="24" width="200">
<td align="center"><a href="####" onclick="test(91)">91</a></td>
........
<td align="center"><a href="####" onclick="test(100)">100</a></td>
</tr>
<tr height="24" width="200">
<td align="center"><a href="####" onclick="test(1)">1</a></td>
........
<td align="center"><a href="####" onclick="test(10)">10</a></td>
</tr>
....................................
<tr height="24" width="200">
<td align="center"><a href="####" onclick="test(91)">91</a></td>
........
<td align="center"><a href="####" onclick="test(100)">100</a></td>
</tr>
解决方案 »
- 如何在一个Solution里面,建立多个Project?
- cnblogs.com上的评论是怎么做的。(AJAX问题,在线等待高手指点)
- 如何用服务器端代码或客户端脚本取得flash动画的纵横比
- 谁有用户权限的模块呢?最好能单独提取出来,可以和别的系统融合的
- oracle 查询 创建
- 有朋友研究过petshop1.5吗,听说里面写了一段通用的存储过程,俺需要插入,删除,修改通常存储过程,是那几个呢。。。
- 怎样在asp.net中读取一个文件的内容
- 高手们行行好,解救痛苦中的兄弟!(关于asp.net论坛几个问题)
- 请问为什么我的复合控件中,子控件 DataGrid 在页面第一次启动时,点排序触发不出来 SortCommand 事件
- 高分悬赏!!怎样使SessionID发生改变?
- 疑惑
- 上传EXCEL,一直提示文件不存在,发现系统获取的路径有问题,如何解决?
foreach(int val in vals)
{
print(string.Format(@"<td align="center"><a href="####" onclick="test({0})">1</a></td>", val.ToString()));
}
print("/tr");
StringBuilder str = new StringBuilder();
str.Append("<tr height=\"24\" width=\"200\">");
for(int i=1;i<=100;i++)
{
str.Append(string.Format("<td align=\"center\"><a href=\"####\" onclick=\"test({0})\">{0}</a></td>",i));
if(i%2==0&&i!=100)
{
str.Append("</tr><tr height=\"24\" width=\"200\">");
}
}
str.Append("</tr>")
string str="<table>"
for(int i=1;i<=10;i++)
{
int k=(i-1)*10;
for(int j=1;j<=10;j++)
{
k=k+j;
str+="<tr height=\"24\" width=\"200\">"
str+="<td align=\"center\"><a href=\"####\" onclick=\"test("+k.toString()+")\">"+k.toString()+"</a></td>"
}
}
str+="</table>"
string str="<table>"
for(int i=1;i<=10;i++)
{
int k=(i-1)*10;
for(int j=1;j<=10;j++)
{
k=k+j;
str+="<tr height=\"24\" width=\"200\">"
str+="<td align=\"center\"><a href=\"####\" oncli……
注:在界面上拖一个Label控件ID="lblShow"后台代码中lblShow.Text=str;即可!
<tr height="24" width="200">
<td align="center"><a href="####" onclick="test(1)">1</a></td>
........
<td align="center"><a href="####" onclick="test(10)">10</a></td>
</tr>
....................................
<tr height="24" width="200">
<td align="center"><a href="####" onclick="test(91)">91</a></td>
........
<td align="center"><a href="####" onclick="test(100)">100</a></td>
</tr>
<%}%>
int num = 100;
Response.Write("<table>");
for (int i = 1; i <= num; i++)
{
if (i % 10 == 1 && i != num)
{
Response.Write("<tr height=\"24\" width=\"200\">");
}
Response.Write("<td align=\"center\"><a href=\"####\" onclick=\"test("+i+")\">"+i+"</a></td>");
if (i % 10 == 0)
{
Response.Write("</tr>");
}
}
Response.Write("</table>");
Response.Write("<table>");
for (int i = 1; i <= num; i++)
{
if (i % 10 == 1)
{
Response.Write("<tr height=\"24\" width=\"200\">");
}
Response.Write("<td align=\"center\"><a href=\"####\" onclick=\"test("+i+")\">"+i+"</a></td>");
if (i % 10 == 0||i==num)
{
Response.Write("</tr>");
}
}
Response.Write("</table>");
<%for(int i=0;i<=100;i++){ %>
<tr height="24" width="200"><td align="center"><a href="#" onclick="test(<%=i %>)"></a></td></tr>
<%} %>
</table> 前台的