the javascript looks fine but the html doesn't look right for a javascript function call.
also the purpose of functions is to write once and call many times, so using
<body onload="printBtn();"> defeats that purpose; so how do we call it again???