<select id="years">
</select>
<script>
var currentYear= new Date().getFullYear();
const yearselect = document.getElementById("years");
for (let year = currentYear; year > currentYear-150; year--)
{
let opt = document.createElement("option");
opt.setAttribute("value", year.toString());
opt.innerHTML = " " + year.toString() + " ";
yearselect.appendChild(opt);
}
</script>
<!-- to get the year -->
<script>
var e = document.getElementById("years");
var selectedYear = e.value;
</script>