Skip to content

Instantly share code, notes, and snippets.

@tekniklr
Created March 26, 2016 21:34
Show Gist options
  • Save tekniklr/b593813f1a1eaa9f1230 to your computer and use it in GitHub Desktop.
Save tekniklr/b593813f1a1eaa9f1230 to your computer and use it in GitHub Desktop.

Revisions

  1. tekniklr created this gist Mar 26, 2016.
    31 changes: 31 additions & 0 deletions null.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <!DOCTYPE html>
    <html lang='en'>
    <head>
    <meta charset='utf-8'>
    <meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
    <meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
    <title>null</title>
    <!-- was curious how this ( http://gizmodo.com/it-really-sucks-to-be-named-jennifer-null-1767159091 ) even happens - how does a form input validate a string value from a submitted form as equivalent to null??? -->
    <script type="text/javascript">
    function do_it() {
    var the_thing = document.getElementById('the_thing').value;
    var interpreted_thing = '';
    if (the_thing == null) {
    interpreted_thing = 'literally null';
    } else if (the_thing == '') {
    interpreted_thing = 'blank';
    } else {
    interpreted_thing = the_thing;
    }
    alert('yo, the thing is '+interpreted_thing);
    }
    </script>
    </head>
    <body>
    <form>
    <label for="the_thing">The thing:</label>
    <input type="text" id="the_thing" />
    <input type="submit" value="what" onclick="javascript:do_it(); return false;" />
    </form>
    </body>
    </html>