各位亲,下面这段html,我想在方法里接收到body里传的那一堆json串,但是报错,调不好,结果是能alert出来值就行。希望各位大神出招
<html> <head> <title>测试</title> <script> //obj为json串 //item为当前元素 function ShowLink(obj,item) { alert(obj); } </script> </head> <body> <dd id="879CCBCF-A39A-4912-844D-669A74BEE9A3" onclick="ShowLink("[{"key":"size","type":null,"until":null,"default":null,"value":[{"name":"85.50*54.00*0.38","code":"85.50*54.00*0.38","isselect":true,"$$hashkey":"object:7489"},{"name":"85.50*54.00*0.76","code":"85.50*54.00*0.76","isselect":true,"$$hashkey":"object:7490"}],"$$hashkey":"object:7484"},{"key":"craftcodes","type":null,"until":null,"default":null,"value":[],"$$hashkey":"object:7485"}]",this)">亮光卡</dd> </body> </html>
百度:字符串转义.
入门买本语法教科书的重要性!