如何在不破坏JS的情况下在onclick事件中嵌入以下参数字符串?现在有双引号碰撞。 onclick事件中的值来自JS变量。
例如:
initializeMap('["2012-02-17 15:39:19.0,33.38727791932264,-86.74324840021933","2012-01-10 00:40:08.0,33.38708092092858,-86.74331461676397"]','%68%74%74%70%3a%2f%2f');
在Onclick事件中:
<a href="#-" onclick="JavaScript:initializeMap('["2012-02-17 15:39:19.0,33.38727791932264,-86.74324840021933","2012-01-10 00:40:08.0,33.38708092092858,-86.74331461676397"]','%68%74%74%70%3a%2f%2f');">Click Me</a>
由于
答案 0 :(得分:2)
"["2012-02-17 15:39:19.0,33.38727791932264,-86.74324840021933","2012-01-10 00:40:08.0,33.38708092092858,-86.74331461676397"]"
答案 1 :(得分:1)
我会为onclick事件寻找一个JS处理程序。
如果您遇到内联JS,请尝试使用
<a href="#-" onclick='initializeMap(["2012-02-17 15:39:19.0,33.38727791932264,-86.74324840021933",
"2012-01-10 00:40:08.0,33.38708092092858,-86.74331461676397"],"%68%74%74%70%3a%2f%2f");'>Click Me</a>