Appendix JS_G_A4


Requirement: All non-text content has an equivalent text alternative.

Details: Functionality that relies on JavaScript should not be present when JavaScript is unavailable.


Correct code

Refer to the JS_G_A4 live demo for a working example.

<p id="demo1">
    <a href="javascript:window.print()">Print this page (1)</a>
var demo1 = document.getElementById('demo1');
demo1.className = 'script-enabled';
var demo2 = document.createElement('p'); = 'demo2';
var link = demo2.appendChild(document.createElement('a'));
link.setAttribute('href', 'javascript:window.print()');
link.appendChild(document.createTextNode('Print this page (2)'));
demo1.parentNode.insertBefore(demo2, demo1.nextSibling);