Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript toggle enabled/disabled

Tags:

javascript

What's the best way to toggle a "Please have Javascript enabled" warning?

Currently I've got something like this:

<div id='JSwarning'>ONLY SQUARES DON'T USE JAVASCRIPT</div>

to which I then apply .style.display = "none".

This shows the warning on every page for a little while until it loads. There must be a more graceful way. Can I do it with PHP?

(BTW, get_browser() is not the solution I'm looking for.)

//EDIT

Thanks everyone, that does the trick. Incidentally, to get the page to validate (XHTML 1.0 Strict), I needed to place the child node(s) in a block container.

like image 552
Ben Avatar asked Nov 30 '25 17:11

Ben


1 Answers

<script></script>
<noscript>Please enable Javascript.</noscript>

http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.3.1


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!