开发者

variable inside another variable

hi there i wanted to put this:

document.write("y = " + i);

inside another variable, like this:

s=s+"\"y = \" \+开发者_如何学编程 i";

but now, i variable is not variable, just a plain text.

how can i fix this? output would be

document.getElementById("output").innerHTML=s;

thank you


You do not pass to s string a variable - just text i. Try with:

s=s+"y = " + i;

You can also convert it to:

s += "y = " + i;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜