Change onclick action with a Javascript function

前端 未结 8 1371
刺人心
刺人心 2020-12-02 12:14

I have a button:


When I click this button the first time, I want it to exe

8条回答
  •  [愿得一人]
    2020-12-02 12:36

    var Foo = function(){
        document.getElementById( "a" ).setAttribute( "onClick", "javascript: Boo();" );
    }
    
    var Boo = function(){
        alert("test");
    }
    

提交回复
热议问题