I currently have some variables that are strings which should go into my p tag's innerHTML depending on the img src thats currently displayed from a slideshow array. onload it should display the variable product1info (which is just a string) and if I hit next or previous in the slideshow the img source changes. Based on that img source the product1info should change to the string that matches the img src. i.e. product1info, product2info, product3info etc.
This is part of my code right now and I'm not sure what this if statement should look like but i think this is where it needs to be fixed:
var imgsource = document.getElementById('slide').src; //this is the img slideshow where I get src from
var infosub = document.getElementById('info'); //this is the paragraph where I am trying to write the productinfo variables
function info(){
if (imgsource == 'productt1.jpg'){
infosub.innerHTML = product1info;
}
}