简体   繁体   English

内联onclick事件中的对象

[英]Object in inline onclick event

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 当我点击图像时出现错误:无效的属性ID

Works like a charm for me : 对我来说就像一个魅力:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM