jsReq

I wanted to tell the user that they need JavaScript, but obviously only if they don’t already have it enabled.
The following is a very crude script which uses the very fact that JS is available to hide the requirement notice…

HTML:

<!-- "jsReq" - Jez McKean (jazzle.co.uk) 2006-04-24 */ -->
<div id="jsRequiredDiv" class="important"><span class="error">Warning!</span>
You need to have javascript enabled to use this page.</div>

JS:

function removeElementById(eleId) {
eleId = document.getElementById(eleId);
if (eleId.parentNode && eleId.parentNode.removeChild) {
eleId.parentNode.removeChild(eleId);
}
}
removeElementById("jsRequiredDiv");

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.