In practical use, I met a shortcomings of JavaScript and a algorithm that I have exploded.
After a SELECT node is created, do not need to delete the secondary node at each time, but to update the content (options) of the node, you must delete the original Options, it is estimated that the language inventor's big best do it. Not good enough, not all delete, and it is necessary to use an algorithm when it is discovered by multiple tests. Only half of the Options length can only be removed each time. The implementation process is as follows:
VAR select = document.createElement ("SELECT");
Var OOPTION = New Array ();
FOR (var i = 0; i <10; i ) {
OOPTION [I] = Document.createElement ("Option");
SELECT.ADD (OOption [I]);
} // Generate a SELECT node
// Deleted algorithm
While (Length! = 0) {var longth = select.Options.LENGTH; for (var i = 0; i