JavaScript agrega elementos de datos a la lista desplegable.html
La copia del código es la siguiente:
<! Doctype html>
<html xmlns = "http://www.w3.org/1999/xhtml">
<Evista>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8"/>
<title> Agregue dinámicamente elementos de datos a la lista desplegable </title>
<script type = "text/javaScript">
function gel (id) {return document.getElementById (id); }
window.onload = function () {
var cbbyear = gel ("mysel");
para (var i = 1990; i <2014; i ++) {
// Método 1
/*var opt = document.createElement ("opción");
opt.innerhtml = i;
cbbyear.appendChild (opt);*/
// Método 2
var opt = nueva opción (i, i);
cbbyear.options.add (opt);
}
};
</script>
</ablo>
<Body>
<select id = "mysel">
</select>
</body>
</html>