cara mengubah tautan atribut di javascript

function changeLink(){
    document.getElementById("mylink").href = "http://facebook.com";
    document.getElementById("mylink").innerHTML = "facebook";
    }
Ashamed Ant