When I write this:
var loc = "a,a\n";
alert(loc);
开发者_Go百科
It shows "a...
" in alert. Then after I add some values in loc as
loc = loc + "abc," + valueFromFunc;
alert(loc);
It shows "ab...a,a\nabc,value
" in alert. Why I get a..
and ab..
in loc? I want loc to be "a,a\nabc,value
"
I'm using Google Chrome. When I tried it in IE it works great but in chrome I got above output.
Screen shot of my google chrome:
I think that thing with the dots is from the browser. In Win Chrome it appears, but under Linux - no.
If you want to dispalay \n use a double slash, to show the second one.
var loc = "a,a\\n";
var valueFromFunc = "gdfgdfg fdgdfg";
loc = loc + "abc," + valueFromFunc;
alert(loc);
精彩评论