This example shows two different ways of ensuring that scripted
functionality is not present when JavaScript is unavailable,
both illustrated using Print this page
links:
display:none
that's applied through a
CSS class. The
content is then displayed again by adding an additional
"script-enabled"
class, and that's done with
JavaScript
The second approach is best, because it means that the content will not re-appear when CSS is also unavailable. However that's not a very common situation, and sometimes the amount or complexity of the HTML makes it impractical to generate through scripting. So the first approach is acceptable if necessary.
The JavaScript code for this example can be found in: JS_G_A4.js
The CSS for this example can be found in: JS_G_A4.css