天天看点

JS传递字符串(字符串转义)

JS函数传递字符串对象,标识字符串的对象如果没有转义处理,在接收的时候无法正确的接收字符串。

(1)在单引号内

'<a href="#" target="_blank" rel="external nofollow" οnclick="news('+row.id+',\''+row.itype+'\')"></a>';

(2)在双引号内

"<a οnclick='lookExpress(\""+order.express_com+"\",\""+order.express_num+"\")'>查物流</a>"