**Ignore incomplete question///Why would a HTML page have a class of ‘javascript’?
views:
84answers:
5Most likely, that refers to individual pages served up depending on whether the client has javascript enabled.
Presumably you are referring to a CSS class to control the formatting, and its name is irrelevant.
Something like:
<span class='javascript'>a = 3 * 5;</span>
Could just as easily be:
<span class='Ben'>a = 3 * 5;</span>
Naming it 'Ben' may not be as good of a reminder when editing the CSS file for what the desired formatting is.
Because whoever wrote it thought that "javascript" was an appropriate class name for it to have? I mean, it's not an invalid class name...
It is a common practice for a page to degrade gracefully in case JavaScript is disabled. For example, instead of a JavaScript slider you may want to present a combo box, or extra submit buttons. This may be required for accessibility and compatibility.
One way of doing so it to load the page ready for JavaScript-disabled clients, and use JavaScript to add a class to the <body>
element (or other elements). CSS rules can use this class to change the look of the page - when you know JavaScript is enabled (after you've just run it), you can hide these controls, and rely on a richer interface.
Perhaps it was code in the page that was to be displayed using Javascript syntax highlighting?
<code class="javascript">document.write("Ben rules!")</code>