#javascript-code-21-setattribute.js / js
// Create a new <a> element var a = document.createElement(“a”). // Set the URL to visit to Google’s web site a.setAttribute(“href”,”http://google.com/”); // Add the inner text, giving the user something to click a.appendChild( document.createTextNode( “Visit Google!” ) ); // Add the link at the end of the document document.body.appendChild( a );
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.