示例:
动态创建的图片:
var newImg = document.createElement('img');
newImg.setAttribute('id', newimage);
如何为此图像提供属性“ondragstart =”drag(event)“”?
感谢。
答案 0 :(得分:0)
使用addEventListener添加活动
public override void PrepareForSegue(NSStoryboardSegue segue, NSObject sender)
{
base.PrepareForSegue(segue, sender);
switch (segue.Identifier)
{
case "UserLoginSegue":
UserLoginController loginSheet = segue.DestinationController as UserLoginController;
var theView = loginSheet.View;
loginSheet.Username = "";
loginSheet.Password = "";
loginSheet.Presentor = this;
loginSheet.DialogAccepted += (object s, EventArgs e) => { Console.WriteLine("OK Clicked"); };
loginSheet.DialogCanceled += (object s, EventArgs e) => { Console.WriteLine("Cancel Clicked"); };
break;
}
}
所以你的代码将是
target.addEventListener(type, listener)
该活动将通过。