Ummm...and if it is turned *OFF* then what good is the function? You can call it as much as you want and since
JS is turned off, nothing will happen.
Yes, you can detect *ON THE SERVER* if
JS is turned on or not, pretty easily. Various ways.
My favorite is to simply do something like this:
Code:
<form action="nextPage.asp" onSubmit="this.jsEnabled.value='YES'; return true;">
<input type=hidden name="jsEnabled" value = "NO">
...
</form>
That target action can of course be .asp, .aspx, .php, .jsp, or whatever server side coding you are using.
Or you could do this (lots of my friends do it, and it works for HTML-only sites as well as ASP/JSP/et al.):
Code:
<form action="nextPageWithOUTjs.html" onSubmit="this.action='nextPageWITHjs.html';">
...
</form>
You can also, of course, have HTML appear ONLY when scripting is OFF via:
Code:
<script>
.... stuff with JS coding ...
</script>
<noscript>
<h1>You must turn on JavaScript for these pages to work!</h1>
</noscript>