Created
March 26, 2016 21:34
-
-
Save tekniklr/b593813f1a1eaa9f1230 to your computer and use it in GitHub Desktop.
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???
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that people on the original article are just as confused as I am! http://gizmodo.com/it-s-not-even-just-bad-programming-it-seems-like-delib-1767173941