Top / Programming / JavaScript / タグを変更する

タグを変更する

タグの属性を変更し、動作を変えます。

document.getElementById() でタグを取得し、属性を変更します。

document.getElementById("link").href = "http://www.google.co.jp";
document.getElementByID("link").firstChild.nodeValue = "Google"
document.getElementById("paragraph").align = "center";