What is a "javascript generated link"?
I saw this l开发者_运维百科anguage in a blog, but am wondering what exactly it means.
That means a hyperlink (a
) or link
that was dynamically created and inserted into the page by JavaScript, as opposed to a link that was in the original HTML.
I imagine it's like this:
<a id="linkId" href="here" display="none">
<script>
document.getElementById("linkId").href = "there";
document.getElementById("linkId").display= "block";
</script>
Or, actually creating the node in the DOM later, like Jacob said, like this:
function insertcode()
{
var code ="<a id="new_link" href="there">link text</a>"
var myText = document.createTextNode(code);
document.getElementById("content").appendChild(myText);
}
I hope this helps.
精彩评论