how to invoke click event from javascript?

前端 未结 1 875
时光说笑
时光说笑 2021-01-25 19:17

Below is my asp(HTML) code

&RS=<%=RecordS         


        
相关标签:
1条回答
  • 2021-01-25 19:56

    This is a simplified version of a function I wrote for a similar question. You can find a list of the arguments to initMouseEvent in the Mozilla Developer Center documentation but you shouldn't need to change anything.

    function clickLink(link) {
        if (document.createEvent) {
            var event = document.createEvent("MouseEvents");
            event.initMouseEvent("click", true, true, window,
                0, 0, 0, 0, 0,
                false, false, false, false,
                0, null);
            link.dispatchEvent(event);
        }
        else if (link.fireEvent) {
           link.fireEvent("onclick");
        }
    }
    
    0 讨论(0)
提交回复
热议问题