I have this piece of code below it functions exactly how i want it too, I just wanna know how to then move in into another .js file. Sorry I'm new with this.
So what I'm pretty much asking is how to call this code in an html document http://jsfiddle.net/BgWjv/
HTML:
<select id="selectday">
<option>Day</option>
<script>
var select = document.getElementById("selectday");
var options = new Array();
var temp = 1;
for(var i = 0; i < 31; i++) {
options.push(temp);
temp++;
}
for(var i = 0; i < options.length; i++) {
var opt = options[i];
var el = document.createElement("option");
el.textContent = opt;
el.value = opt;
select.appendChild(el);
}
</script>
</select>
<script>tag referencing an external file.