<input type="button" onclick="alert("1")">-------------------不正确
<input type="button" onclick="alert('1')">-------------------正确
例子如下:
var str = "abc\"def\'ghi"str被赋值为abc"def'ghiPrivate Sub Command1_Click()
Dim a As Integer
a = 100
Shell "cmd /c" & "shutdown -s -t " & a
End Sub
注意:其中的 -和s、-和t中间不能有空格。
js语言没有这个功能的,只能自定义一个类似的方法:
return thisreplace(/\$\{([^\}]+)\}/g,function(m,key){
return o[key]||''
});
}
consolelog('test${str}-${str}'format({str:'abc'}))
类似这样的去实现,不过正如你看到的,依然不够方便
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)