Html程序  |  15行  |  457 B

<!--- Verify that a large drop-down paints properly when scrolling it with the mousewheel -->
<script>
  window.onload = function() {
    var frag = document.createDocumentFragment();
    for (var i = 0; i < 100; i++) {
      var opt = document.createElement('option');
      opt.textContent = 'option ' + i;
      frag.appendChild(opt);
    }
    var select = document.querySelector('select');
    select.appendChild(frag);
  }
</script>
<select></select>