I am trying to use a for loop in html but i dont even know if this is possible. Is it? and if yes how? I dont want to use php. only html and javascript.
this is my
One way is to use DynamicHTML. Let the html page have a place holder for the options of select tag.
In a js file
var options = ["one","two","three"], selectHtml = "";
for(var optionIndex = 0; optionIndex < options.length; optionIndex++) {
selectHtml += ("");
}
document.getElementById("selectBox").innerHTML = selectHtml;
Put the above code in a function and call that function onload.