| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

MEMO

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <link href="../css/style.css" type="text/css" rel="stylesheet">
  6. <style type="text/css">
  7. </style>
  8. <script type="text/javascript" src="../js/jquery-1.4.1.min.js"></script>
  9. <script type="text/javascript" src="../js/jquery.chromatable.js"></script>
  10. <script type="text/javascript" src="../js/jquery-ui-1.7.2.custom.min.js"></script>
  11. <script type="text/javascript"><!--
  12. $(document).ready(function() {
  13. $("#tbl1").chromatable({
  14. width: "300px",
  15. height: "100px",
  16. scrolling: "no"
  17. });
  18. $("#addbtn").click(function() {
  19. var item = Object();
  20. item.name = $("#item_name").val();
  21. var row_id = "tr_" + item.name;
  22. $("#tbl1 tbody").append("<tr id='" + row_id + "'></tr>");
  23. var tr = $("#" + row_id);
  24. var td_id = "td_" + item.name;
  25. tr.append("<td id='" + td_id + "'>" + item.name + "</td>");
  26. var td_head = $("#" + td_id);
  27. td_head.click(function(){alert(row_id);});
  28. tr.append("<td><input type='text' style='width:90px;'/></td>");
  29. tr.append("<td><select></select></td>");
  30. });
  31. });
  32. //--></script>
  33. <title></title>
  34. </head>
  35. <body>
  36.  
  37. <div>
  38. name:<input type="text" id="item_name"/><br/>
  39. <input type="button" id="addbtn" value="add row"/>
  40. </div>
  41. <table id="tbl1" style="table-layout:fixed;width:300px;">
  42. <col width="100px">
  43. <col width="100px">
  44. <col width="100px">
  45. <thead>
  46. <th>f1</th>
  47. <th>f2</th>
  48. <th>f3</th>
  49. </thead>
  50. <tbody>
  51. </tbody>
  52. </table>
  53.  
  54.  
  55. </body>
  56. </html>