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: 863 • Replies: 0
No top replies

 
 

Related Topics

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
Software Copyright - Discussion by Kolyo
 
  1. Forums
  2. » im new to javascript so please explain this code
Copyright © 2019 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 03/18/2019 at 11:30:34