0

テーブルに一連のテキスト ボックスがあり、Shift + 下矢印キーを押して複数のテキスト ボックスの値を選択したいと考えています。テキストボックスを選択している間、値をコピーして配列に保存する必要があります...誰か助けてください...

<style>
  #feedback { font-size: 1.4em; }
  #selectable .ui-selecting { background: #FECA40; }
  #selectable .ui-selected { background: #F39814; color: white; }
  #selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
  #selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
  </style>
<script>

$(function(e) {


    $( "#selectable" ).selectable({selected: function( event, ui ) {alert(this)}});
  });

</script>
<body>
<table width="78%" border=1 id="selectable" style="border-collapse:collapse">
<tr>
<td><input type="text" class="ui-widget-content"   /></td>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>

</tr>
<tr>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>

</tr>
<tr>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>

</tr>
<tr>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>
<td><input type="text"  class="ui-widget-content"/></td>

</tr>
</table>
</body>
</html>
4

3 に答える 3

0

jquery を使用します。

あなたが使用することができます

 $("your id").keypress(function(e){
    //here you find e.KeyCode if it is equal to shift+down_arrow then take the values of text box here as $("#yout text box id").val(); and store it into an array.

    });
于 2013-10-09T07:58:12.547 に答える
0

これは、チェックされていないボックスをチェックして、それらのボックスの値を取得できるようにするコードです (Shift + 上下矢印を使用) ...

完全な作業コードはこちら =>フィドル

ニーズに合うように少し調整することができます。

$(function () {
    var keys = {},    // Keys strokes state
        storage = {}; // Tracking of checked checkboxes values
    $(document).keydown(function (e) {
        // UPDATE Keys strokes state to memorize simultaneous keydown ...
        // THEN update values storage
    }).keyup(function (e) {
        // UPDATE Keys strokes to remove released keys
    }).click(function(e){
        // UPDATE values storage in case a checkbox get clicked ...
    });
});
于 2013-10-09T11:05:20.967 に答える