<?php
// this would not work if no html tags
// you can comment the line after this if you already have a open html and body tag
echo '<html><body>';
// stores the value of js if the form is submitted otherwise off
$js = array_key_exists('js', $_POST) ? $_POST['js'] : '';
// if $js is on, the form was submitted by the javascript submit()
if ($js=="on"){
echo "Javascript is enabled.";
}
// otherwise display the form and try to submit the form with javascript
else{
echo '<form name="js_form" method="post"><input type="hidden" name="js" value="on"></form>';
echo '<script type="text/javascript">document.js_form.submit()</script>';
echo "Javascript is disabled.";
}
// you can comment the line after this if you already have a close body and html tag
echo '</body></html>';
?>
No comments:
Post a Comment