我在Jquery中将变量值放在引号中时遇到问题:
例如:
我有一个可变颜色的Html颜色代码,其值为#FFFF00.我想显示这样的变量值:"#FFFF00".
我试过这样的东西,但它不起作用:
context.strokeStyle = "\"color\"";
Run Code Online (Sandbox Code Playgroud)
如果要显示包含在引号中的字符串,则只需使用:
context.strokeStyle = '"' + color + '"';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4842 次 |
| 最近记录: |