UIWebView Javascript onclick事件未向函数发送事件对象
我正在使用简单的NSString动态插入HTML,然后将其加载到UIWebview中,我正在这样做:UIWebView Javascript onclick事件未向函数发送事件对象,javascript,html,ios,uiwebview,dom-events,Javascript,Html,Ios,Uiwebview,Dom Events,我正在使用简单的NSString动态插入HTML,然后将其加载到UIWebview中,我正在这样做: [NSString stringWithFormat:@"<div onclick=\"MyClickEvent(e);\"....some more text here"> 由于参数作为e传递的方式,函数永远不会被调用,如果我使用如下引用: function MyClickEvent(e) { //Some other code here e.stopPropag
[NSString stringWithFormat:@"<div onclick=\"MyClickEvent(e);\"....some more text here">
由于参数作为e传递的方式,函数永远不会被调用,如果我使用如下引用:
function MyClickEvent(e)
{
//Some other code here
e.stopPropagation();
return false;
}
[NSString stringWithFormat:@"<div onclick=\"MyClickEvent('e');\"....some more text here">
<div onclick="MyClickEvent(e);">
[NSString stringWithFormat:@”我已经让它工作了,显然您需要做的是:
[NSString stringWithFormat:@"<div onclick=\"MyClickEvent(event);\"....some more text here">
[NSString stringWithFormat:@”