Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var places = []; //new array to store entered places
- var i - 0; //counter variable to track array indexes
- function processInput() {
- if (i < 5) {
- places[i] = document.getElementById("placesBox").value; //add input
- document.getElementById('placesBox").value = "";
- i++
- }
- else { //add entered value to the array and write results to document
- document.getElementById("resultsExpl").innerHTML = "You entered:"
- var listItem = "";
- for (j = 1; j < 6; j++){
- listItem = "item" + j;
- document.getElementById(listItem).innerHTML = places[j - 1];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement