Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @{ Layout = "~/_MasterLayout.cshtml"; }
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
- <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
- <script type="text/javascript">
- $(document).ready(function () {
- $("input[type='checkbox']").click(function () {
- var tr = $(this).parents('tr').remove();
- var tableId = $(this).parents('table').attr('id');
- if (tableId == 'firsttable') {
- $('#secondtable tbody').append(tr);
- } else {
- $('#firsttable tbody').append(tr);
- $("#firsttable .del").remove();
- }
- });
- $("#input_button").click(function () {
- var $str = $('#input_text').val()
- $('#input_text').val(' ')
- // document.getElementById('firsttable').innerHTML += '<tr><td><input type="checkbox" id ="'+$str+'"></td><td><p>'+$str+'</p></td><td class="del"><input type="button" id="input_button" value="X"></td></tr>'
- var tds = '<tr><td><input type="checkbox" id ="' + $str + '" name=""></td><td><p>' + $str + '</p></td></tr>'
- if ($('tbody', '#firsttable').length > 0) {
- $('tbody', '#firsttable').append(tds);
- } else { $('#firsttable').append(tds); }
- });
- $('.del').click(function () {
- $(this).parents('tr').remove();
- });
- });
- </script>
- </head>
- <body>
- <input type="text" id="input_text">
- <input type="button" id="input_button" value="Добавить">
- <p>Нужно сделать</p>
- <table id="firsttable">
- <tr id="check1"><td>@Html.CheckBox("Chek1",false)</td><td><p>Повторить теорию</p></td></tr>
- <tr><td>@Html.CheckBox("Chek2",false)</td><td><p>Сдать экзамен</p></td></tr>
- <tr><td>@Html.CheckBox("Chek3",false)</td><td><p>Купить торт</p></td></tr>
- </table>
- <p>Сделано</p>
- <table id="secondtable">
- <tr id="check1"><td>@Html.CheckBox("Chek4",true)</td><td><p>Весело провести новый год, Рождество</p></td><td></td><td class="del"><input type="button" id="input_button" value="X"></td></tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement