在javascript中添加asp图像按钮

时间:2013-08-25 17:57:21

标签: c# javascript asp.net

我需要在javascript函数中添加asp图像按钮。实际上我需要动态地在html表中创建图像按钮。这是我的代码。我需要添加我提到的图像按钮“---这里我需要添加图像按钮---”

function tableSeats() {
  document.write("<table align=center>");
  for (var i = 1; i <= 5; i++) {

      document.write("<tr height=30px>");

      for (var r = 1; r <= 10; r++) {
          document.write("<td width=30px>");
          document.write(--- Here I need to add the image button ---);
          document.write("</td>");
      }

      document.write("</tr>");
  }
  document.write("</table>");
}

如果无法做到这一点,请告诉我使用c#.net的方法 提前谢谢......

1 个答案:

答案 0 :(得分:1)

我相信通过使用javaScript,您无法创建任何类型的服务器控件,如图像按钮和所有。但你可以做一些像<img />这样的事情。使用jQuery,你可以调用客户端点击并使用ajax,你可以轻松地与服务器通信。

function tableSeats() {

  document.write("<table align=center>");
  for (var i = 1; i <= 5; i++) {

      document.write("<tr height=30px>");

      for (var r = 1; r <= 10; r++) {
          document.write("<td width=30px>");
          document.write("<img src='Your picture path' alt='' />");
          document.write("</td>");
      }

      document.write("</tr>");
  }
  document.write("</table>");
}

更新了代码

选中此项以查看jQuery http://api.jquery.com/click/