JS --- Case: Click the button to set the background color gradient div

Case: Click the button to set the background color gradient div

Background color gradient: Set Transparency

  <div the above mentioned id = "dv"> </ div> 
  <the INPUT of the type = "the Button" value = "graded" the above mentioned id = "btn" /> 
  <Script src = "common.js"> </ Script> 
  <Script> 

    My $ ( . "BTN") the onclick = function () {
       var Opacity = 10 ;
       var TimeID = the setInterval ( function () {
         // made transparent 
        opacity-- ;
         IF (Opacity <= 0 ) { 
          the clearInterval (TimeID); // // cleanup timer 
        }
         // set div transparency 
        My $ ( "DV") style.opacity opacity = / 10. ;
      }, 200);
    };

  </script>

 

 

Guess you like

Origin www.cnblogs.com/jane-panyiyun/p/12029254.html