Skip to content

Instantly share code, notes, and snippets.

@dasoran
Created February 21, 2013 22:01
Show Gist options
  • Save dasoran/5008678 to your computer and use it in GitHub Desktop.
Save dasoran/5008678 to your computer and use it in GitHub Desktop.
DOM API を用いた A タグ生成コード。linkUrl に script タグが埋め込まれてもコードは実行されない。
function buildAtag(target, linkUrl, linkName) {
var element = document.createElement("a");
element.setAttribute("href", linkUrl);
element.innerText = linkName;
target.appendChild(element);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment