If valuationId and user are JavaScript variables, and the source code is plain static HTML, not generated by any means, you should try:<a href=# onclick="return ReAssign(valuationId,user)">Re-Assign</a>如果它们是从PHP生成的,并且包含字符串值,请在每个变量周围使用转义的引号,如下所示:If they are generated from PHP, and they contain string values, use the escaped quoting around each variables like this:<?php echo '<a href=# onclick="return ReAssign(\'' + $valuationId + '\',\'' + $user + '\')">Re-Assign</a>';?>逻辑与问题中的更新代码相似,后者使用JavaScript(也许使用jQuery?)生成代码:不要忘记将转义的引号应用于每个变量:The logic is similar to the updated code in the question, which generates code using JavaScript (maybe using jQuery?): don't forget to apply the escaped quotes to each variable:var user = element.UserName;var valuationId = element.ValuationId;$('#ValuationAssignedTable').append('<tr> <td><a href=# onclick="return ReAssign(\'' + valuationId + '\',\'' + user + '\')">Re-Assign</a> </td> </tr>'); 故事的寓意是'someString(\''+'otherString'+','+'yetAnotherString'+'\')'将被评估为:someString('otherString,yetAnotherString');您将需要:someString('otherString','yetAnotherString'); 这篇关于在HTML链接中使用onClick传递多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-12 16:13