Changing button color programmatically

后端 未结 7 1790
一整个雨季
一整个雨季 2020-12-16 10:13

Is there a way to change the color of a button, or at least the color of the button label programmatically? I can change the label itself with

document.getE         


        
7条回答
  •  猫巷女王i
    2020-12-16 10:44

    Try this code You may want something like this

    
    

    Then on your .js file enter this.Make sure your html is connected to your .js

    var tag=document.getElementById("myButton");
    
    function mouseOver() {
        tag.style.background="yellow";
    };
    function mouseOut() {
        tag.style.background="white";
    };
    

提交回复
热议问题