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]);

 

相关文章