Making entering different text lead to different locations not working

I’m trying to make a page that when you enter different words, they lead you to different pages. (inspired by thisisnotawebsitedotcom.com) However, I can’t seem to get it working. I’m new to coding and not sure what I’m doing wrong or how to fix it.

Here’s what I’ve got:

<!DOCTYPE html>
<html><head>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>&#9734;</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<script>
if(document.getElementById('text').value == 'hi'){
    alert('hi :)');}
if(document.getElementById('text').value == 'link'){
  location.href = "http://google.com";
    else{
      return false;}
</script>
</head>
<body>
<center>
<form method="get" onclick="document.getElementByID('text')">
<input type="text" id="text">
</form>
</center>
</body>

Whenever I actually try it out, no matter what I enter, whether it be “hi”, “link”, or something else, it just takes me to the same page but adds /? to the end of the link.