Insert javascript variable into html output .innerHTML =

I am trying to insert a variable passed to my function into the output of my .innerHTML = code, but I don’t know how to correctly insert it into the HTML output.

function playsong(song)
{
    parent.document.getElementById('player').innerHTML = '<object width="199" height="26"><param name="movie" value="audio_player_black.swf"><embed src="audio_player_black.swf?audio_file=upload/'[song]'&color=00000" width="199" height="26"></embed></object>';
}

I just get [song] in my HTML output and not the value of [song]

I don’t know how to do it properly

+5
source share
3 answers

easily:

parent.document.getElementById('player').innerHTML = '<object width="199" height="26"><param name="movie" value="audio_player_black.swf"><embed src="audio_player_black.swf?audio_file=upload/'+song+'&color=00`000" width="199" height="26"></embed></object>';

just like concatenating any 2+ lines

+10
source

Instead:

[song]

using:

 +song+
+6
source

[song] +song+. , .

0

All Articles