[英]Javascript Issue with creating a link
I am creating a link like this: 我正在创建这样的链接:
$("#div_"+id+" .boxcontent").html("<div align='right'><a href='javascript:loadHistory('" + item.f + "','" + boxtitle + "');'>Load History</a></div>");
but it is breaking the code, 但它破坏了代码,
i am trying to make it like this: 我正在尝试使它像这样:
<div align='right'><a href='javascript:loadHistory("sender","receiver");'>Load History</a></div>
You are using quotes incorrectly. 您使用的引号不正确。 Change from
从
<a href='javascript:loadHistory('" + item.f + "','" + boxtitle + "');'>
to 至
<a href='javascript:loadHistory(\"" + item.f + "\",\"" + boxtitle + "\");>
Note I have escaped the double quotes "
using \\
. 注意:我躲过了双引号
"
使用\\
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.