玩笑过后

导航

14.3.4移动和重排选项

1、appendChild()

  

var selectbox1 = document.getElementById('selLocations1');
        var selectbox2 = document.getElementById('selLocations2');

        selectbox2.appendChild( selectbox1.options[0] );

 

2、insertBefore()

var optionToMove = selectbox.options[1];
selectbox.insertBefore(optionToMove,selectbox.options[optionToMove.index
+2]);

 

posted on 2018-11-04 11:00  玩笑过后  阅读(105)  评论(0)    收藏  举报