Need to add a variable to a filename to display an image file related to the variable's number while simultaneously replacing the img src in the HTML code.
i.e.:
<img id="planet" src="planet0.jpg" alt="" />
<script>
document.getElementById("planet").src="planetmapNu m.jpg";
</script>
where mapNum is the variable
1) is my coding correct at all?
2) how would I make the filename work with the variable?
i.e.:
<img id="planet" src="planet0.jpg" alt="" />
<script>
document.getElementById("planet").src="planetmapNu m.jpg";
</script>
where mapNum is the variable
1) is my coding correct at all?
2) how would I make the filename work with the variable?