未捕获的ReferenceError:未在HTMLAnchorElement.onclick

时间:2018-07-03 05:17:26

标签: javascript php html ajax

$dd = "<a href='javascript:void(0);' id='requestsend$send_id' onClick='request($send_id,request_send);' class='post-add-icon inline-items'><button type='button' style='background: #ccc;' class='btn btn-add-frnd'  data-toggle='tooltip' title='request' data-original-title='Mark as read'>send</button></a>";

我变得这样:

  

未捕获的ReferenceError:请求未定义       在HTMLAnchorElement.onclick

我期望这样:

<a href='javascript:void(0);' id='requestsend$send_id' onClick='request("5","request_send");' class='post-add-icon inline-items'><button type='button' style='background: #ccc;' class='btn btn-add-frnd' data-toggle='tooltip' title='request' data-original-title='Mark as read'>send</button></a>

但是得到了:

<a href='javascript:void(0);' id='requestsend$send_id' onClick='request(5,request_send);' class='post-add-icon inline-items'><button type='button' style='background: #ccc;' class='btn btn-add-frnd' data-toggle='tooltip' title='request' data-original-title='Mark as read'>send</button></a>

1 个答案:

答案 0 :(得分:0)

请尝试以下代码:

 <a href='javascript:void(0);' id='requestsend$send_id' onClick='request(&#39 $send_id &#39, &#39 request_send &#39);' class='post-add-icon inline-items'><button type='button' style='background: #ccc;' class='btn btn-add-frnd' data-toggle='tooltip' title='request' data-original-title='Mark as read'>send</button></a>