Appendix JS_G_A6

Summary

Requirement: Information and structure can be programmatically determined.

Details: Use functions of the DOM to add content to a page.

Examples

Correct code

Refer to the JS_G_A6 live demo for a working example.

<p id="demo"></p>
var paragraph = document.getElementById('demo');
 
var link = document.createElement('a');
link.setAttribute('href', 'http://www.accessibilityoz.com.au/');
link.appendChild(document.createTextNode(
    'This link was created using standard DOM functions'));
 
paragraph.appendChild(link);