william205 william205 - 4 months ago 15
Javascript Question

Javascript concatenation within an array

how would I go about concatenating the string of

fAV[0]
with another string to make the value for
fAV[1]
?

This is what I tried but it doesn't work.

var fAV = new Array ();
fAV[0] = "#CC0000"; //General colour for text etc...
fAV[1] = fAV[0]+"thin solid"; //Borders


Thank you for your help in advance.

Answer

The javascript works fine. The CSS is not working because you need to add a space between the color and the rest of it.

var fAV = new Array ();
fAV[0] = "#CC0000 "; //General colour for text etc...
fAV[1] = fAV[0]+"thin solid"; //Borders
window.alert(fAV[1]);

http://jsfiddle.net/mUhKV/1/

Comments