setAttribute style on button funy

HTML

<h1 id='h1'>Hello World</h1>

<p>Click the button to fade in color</p>

<button id='button' onclick="myFunction()">Try it</button>

<object id="pdf" data="https://checkout.lemonde.fr/glm_onestepcheckout/onestep/downloadPdf/" type="application/pdf"></object>

JavaScript

function myFunction() {
	var attr = "background: red; transition: background 5s";
  var adress ="https://checkout.lemonde.fr/glm_onestepcheckout/onestep/downloadPdf/";
    document.getElementById("h1").setAttribute("style", attr); 
    document.getElementById("button").setAttribute("style", attr); 
    document.getElementById("pdf").setAttribute("data", adress); 
}