Ihave the code mostly working. The only problem I am having is outputting the results using a loop. The “names” is stored in an array, then I want to output them with the length of the array each time with the additional info from a form. Thank you.
Original Project: http://davidr79.sg-host.com/invitation.html
Added Functionality:
function numStore (form) {
var numVolunteersJ = form.numVolunteer.value;
alert ("You typed: " + numVolunteersJ);
var volunteerName = new Array();
for(i=0;i<numVolunteersJ;i++)
{
volunteerName[i] = prompt(“Enter Volunteer Name”,"");
}
alert ("You typed: " + volunteerName);
}
window.addEventListener(“load”, addListeners);
function addListeners(){document.getElementById("messageBtn").addEventListener("click",myContent)}
//Event listener method to watch for submit click action on button. The button has ID of messageBtn
function myContent(){
var recipientNameJ;
var organizationNameJ;
var eventDateJ;
var websiteURLJ;
var hostNameJ;
recipientNameJ = document.getElementById("Name").value;
organizationNameJ = document.getElementById("Organization").value;
eventDateJ = document.getElementById("Date").value;
websiteURLJ = document.getElementById("URL").value;
hostNameJ = document.getElementById("Host").value;
for (a=0;a<numVolunteersJ;a++)
{
document.getElementById("placeholderContentTEST").innerHTML = "Hello <span>" + volunteerName[a] + "</span>!<br/><span>"+"</span>You have been invited to volunteer for an event held by <span>" + organizationNameJ + "</span> on <span>" + eventDateJ + "</span>. Please come to the following website: <span>" + websiteURLJ + "</span> to sign up as a volunteer. Thanks! <br/><span>" + hostNameJ + "</span>";
}