Javascript / HTML
<script type="text/javascript">
function configurator(clicked)
{
myGlobalObject.onLinkClicked(clicked.name);
}
</script>
<a name="link1" href="#" onclick="configurator(this)">Link 1</a>
<a name="link2" href="#" onclick="configurator(this)">Link 2</a>
我正在使用Awesomium的JSObject.bind方法从C#调用Javascript方法。但是,当链接点击时,我不知道如何返回链接名称(&lt; a name ='将此返回到C#'&gt;)。有人能帮助我吗?
C#
using (JSObject myGlobalObject = webControl1.CreateGlobalJavascriptObject("myGlobalObject"))
{
myGlobalObject.Bind("onLinkClicked", true, (sen, eve) =>
{
//Don't know what code to write here....
});
}
答案 0 :(得分:0)
这应该可以解决问题
clicked.getAttribute("name")