代码之家  ›  专栏  ›  技术社区  ›  Wilmar Arias

如何在bridge.net c_上的事件中获取html对象?

  •  1
  • Wilmar Arias  · 技术社区  · 6 年前

    在bridge.net中,我只能创建一个默认事件列表器。 在javascript中,我将这样做。

    <div id="nose" onclick="Test(this);"></div>
    <script>
        function Test(htmlelement) {
            var id = htmlelement.id;
    
            console.log('area element id = ' + id);
        }
    </script>
    
    1 回复  |  直到 6 年前
        1
  •  1
  •   Wilmar Arias    6 年前

    我是这样解决的。

    public Static void SomeFunc(){
    
                    var label = new HTMLLabelElement();
                    label.TextContent = txtbox.Value;
                    label.Style.FontSize = "40px";
     label.AddEventListener(EventType.Click,ClickEvent );
    
    }
    
        public static void ClickEvent (Event e)
                {
                    var x = (HTMLElement)e.Target;
                   x.SetAttribute("value", "HelloWorld");
                }