html5 – Adding javascript to html 5 head tag without using deprecated tags


I’m going strictly HTML 5 here with my code and it doesn’t work without adding deprecated tags “type” and “language” within script.

Isn’t “type” deprecated? Why did I read that HTML 5 input elements introduced several new values for the type attribute?

<!DOCTYPE html>

<html>
   <head>
    <script type = "text/javascript">
         
         function showResult() {
            x = document.forms("myform")("newinput").value;
            document.forms("myform")("result").value = x;
         }
      </script>
   </head>
   
   <body>

      <form action = "/cgi-bin/html5.cgi" method = "get" name = "myform">
         Enter a value : <input type = "text" name = "newinput" />
         <input type = "button" value = "Result"  onclick = "showResult();" />
         <output name = "result"></output>
      </form>
        
   </body>
</html>