Friday, February 23, 2024
 Popular · Latest · Hot · Upcoming
68
rated 0 times [  75] [ 7]  / answers: 1 / hits: 26255  / 15 Years ago, wed, may 27, 2009, 12:00:00

I am trying to insert a variable passed to my function into the output of my .innerHTML = code but do not know how to properly 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 rather than the value of [song]



Not sure how I need to do this properly


More From » html

 Answers
54

easy:



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 + strings


[#99444] Friday, May 22, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kareem

Total Points: 733
Total Questions: 110
Total Answers: 102

Location: Bermuda
Member since Thu, Apr 20, 2023
11 Months ago
;