的JavaScript。如何调用对象内的onclick函数?

时间:2016-07-20 08:36:32

标签: javascript html

我有这个地图区域。

HTML:

<area shape="rect" coords="211,38,238,60" onclick="cancel()">


function cancel()
{
}

现在我该如何在对象中执行此操作?

JS:

var images = {
    dosomething: {
        path: 'asdf.jpg',
        areas: [{
             coords: '211,38,238,60',
            text: 'dosomething',
            onclick: cancel()   // like this ?    
    }]
    },
  }

0 个答案:

没有答案