简体   繁体   English

引号中的Javascript变量

[英]Javascript variable in quotes

hai hai

I want to give a javascript variable within a double Quotes , Can any one help me? 我想在双引号内给出一个javascript变量,有人可以帮我吗?

您是否尝试过在双引号前使用\\来转义字符?

var myVar="this is my text in \"double quotes\"";

使用json_encode()

var myString = <?=json_encode('This is a "test".');?>;

I think you're talking about string concatenation. 认为您是在谈论字符串串联。 If so, it's like: 如果是这样,它就像:

a = "word";
b = "there should be another " + a + " in the middle of this string.";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM