Javascript Replacing Spaces within an Array -


I'm fine on PHP, but there is nothing about javascript, so I do not know how to proceed here I'm trying to change the space with "+" in the line. Why is not anyone doing this work? Thanks! var tn_dv_suggestions = New Array (); For (var tn_counter = 0; tn_counter & LT; tn_top_performers.length; tn_counter ++) tn_top_performers [tn_counter] = tn_top_performers [tn_counter] .replace ( "", "+"); Tn_dv_suggestions.push ( "& lt; a style =" font-family: Verdana, Arial; font-size: 14px; 'target =' _ blank 'href =' http: //www.< ?? = $ Siterow [ ' domain '] & gt; / Buy - "+ escape (tn_top_performers [tn_counter]) +' - & lt; ?? = urlencode ($ siterow [ 'CitySearchName']) & gt; -Tickets' & gt;" + tn_top_performers [ tn_counter] "for & lt; / a & gt; & lt; br / & gt;"); document.getElementById ( 'tn_dv_suggestions089hZ') innerHTML = tn_dv_suggestions.join ( '').

Your use of String.replace () is OK. The problem is that you want curly bracket around all the statements in the loop Are missing.

Fixed Code:

  var tn_dv_suggestions = new Array (); (Var tn_counter = 0; tn_counter & lt; tn_top_performers.length; tn_counter ++) {tn_top_formers [tn_counter] = tn_top_forformers [tn_counter] .replace ( "", "+"); Tn_dv_suggestions.push ( "& lt; a style =" font-family: Verdana, Arial; font-size: 14px; 'target =' _ blank 'href =' http: // www . & Lt ?? = $ Siterow ['Domain']? & Gt; "Buy" - "+ Saved (tn_top_forformers [tn_counter]) +" - & lt ;? = Urlencode ($ siterow ['CitySearchName'])? & Gt; -Tickets' & gt; "+ Tn_top_formers [tn_counter] +" & lt; / A & gt; & Lt; Br / & gt; ");} Document.getElementById ('tn_dv_suggestions089hZ'). InnerHTML = tn_dv_suggestions.join ('');    

Comments