I’m new to javascript and I’m trying to learn.
I’d like my webpage to dynamically show an image from another parent site based on the actual data.
I tried to create the function to get the variables I need in order to get the image at the correct url
I read Variable for img src= but I got lost, then I tried to do something like this
function LoadPage() {
var today = new Date();
var yyyy = today.getFullYear();
var mm = (today.getMonth()+ 1);
var dd = (today.getDate();
img.src = "http://www.parentsite.com/"+yyyy+"_"+mm+"_"+dd+"/images.png"();
}
</script>
Could anyone please help me with this?
Thank you
Assuming your image tag has the id img, the alert line should tell you wether you are setting up your image path correctly