开发者

Object in inline onclick event

开发者 https://www.devze.com 2023-02-17 10:49 出处:网络
Why is this not working ? <img id=\"xx\" src=\"/Content/components/imgs/add.gif\" onclick=\'ShowLookup({\"id\": \"22\",\"name\": \"Robert Pitt\"})\' />

Why is this not working ?

<img id="xx" src="/Content/components/imgs/add.gif" onclick='ShowLookup({"id": "22","name": "Robert Pitt"})' />
开发者_运维问答

or

<img id="xx" src="/Content/components/imgs/add.gif" onclick='ShowLookup("id": "22","name": "Robert Pitt")' />

When I click on the image I got an error: Invalid property id


Works like a charm for me :

http://jsfiddle.net/neebz/uwywG/1/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号