Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

Concatenating Variable with File Name

$
0
0
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?

Viewing all articles
Browse latest Browse all 2703

Trending Articles