JS function is passed string argument (escape symbol)

Original link: https://blog.csdn.net/Myname_China/article/details/82907965

JS function is passed string argument, if there is no escape processing, when the received character string can not be received correctly.

In double quotes

<a href="javascript:orderDetails(\''+orderId+'\')">查看详情</a>
<a href="javascript:void(0)" onclick="orderDetails(\''+orderId+'\')">查看详情</a>

In single quotes

<a href='javascript:orderDetails(\""+orderId+"\",\""+orderName+"\")'>查看详情</a>
<a href='javascript:void(0)' onclick='orderDetails(\""+orderId+"\",\""+orderName+"\")'>查看详情</a>

If the parameter type int, and the escape unquoted

Guess you like

Origin www.cnblogs.com/yxmhl/p/11622534.html