1
I wonder if the JS command document.links
take all links from the website or just from the page??
1
I wonder if the JS command document.links
take all links from the website or just from the page??
2
According to the documentation, all elements <a>
with href
defined are listed by the function Document.links
.
The
links
read-only Property of theDocument
interface Returns a Collection of all<area>
Elements and<a>
Elements in a Document with a value for thehref
attribute.Exemple:
var links = document.links; for(var i = 0; i < links.length; i++) { var linkHref = document.createTextNode(links[i].href); var lineBreak = document.createElement("br"); document.body.appendChild(linkHref); document.body.appendChild(lineBreak); }
In free translation:
The read-only property
links
of the interfaceDocument
returns a collection of all elements<area>
and elements<a>
of a document with a value for the attributehref
.
Browser other questions tagged javascript html
You are not signed in. Login or sign up in order to post.