0

我在这里使用我的代码严格使用 HTML 5,如果不在脚本中添加不推荐使用的属性“类型”和“语言”,它就无法工作。

“类型”不是被弃用了吗?为什么我读到 HTML 5 输入元素为 type 属性引入了几个新值?

<!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>
4

0 回答 0