JavaScript adiciona itens de dados à lista suspensa.html
A cópia do código é a seguinte:
<! Doctype html>
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8"/>
<Title> Adicione dinamicamente itens de dados à lista suspensa </ititle>
<script type = "text/javascript">
função gel (id) {return document.getElementById (id); }
window.onload = function () {
var cbbyear = gel ("mysel");
for (var i = 1990; i <2014; i ++) {
// Método 1
/*var opt = document.createElement ("option");
opt.innerhtml = i;
cbbyear.appendChild (opt);*/
// Método 2
var opt = nova opção (i, i);
cbbyear.options.add (opt);
}
};
</script>
</head>
<Body>
<select id = "mysel">
</leclect>
</body>
</html>