0
   

im new to javascript so please explain this code

 
 
Navdeep
 
Reply Sun 14 Feb, 2016 11:16 pm
// Week05: collections.js
// Script to demonstrate using the links collection.
function processLinks()
{
var linksList = document.links; // get the document's links
var contents = "<ul>";

// concatenate each link to contents
for ( var i = 0; i < linksList.length; ++i )
{
var currentLink = linksList[ i ];
contents += "<li><a href='" + currentLink.href + "'>" +
currentLink.innerHTML + "</li>";
} // end for

contents += "</ul>";
document.getElementById( "links" ).innerHTML = contents;
} // end function processLinks

window.addEventListener( "load", processLinks, false );
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 1,461 • Replies: 0
No top replies

 
 

Related Topics

HVAC lines - Question by alevythiebaut
css - Question by keerthi60
Random Walk in Python Code - Question by Cbr600
Hacked on Facebook - Question by Hopea
need help with this code - Question by Philoue
Hide/Unhide Columns - Question by N Prakash
Help with a Code - Question by Joshua5
 
  1. Forums
  2. » im new to javascript so please explain this code
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.06 seconds on 12/09/2024 at 12:19:37