HTML5 中的输入类型 URL

javascriptweb developmentfront end scripts

这在 HTML5 中仅接受 URL 值。此类型用于应包含 URL 地址的输入字段。如果您尝试提交简单文本,它会强制仅输入 http://www.qries.com 格式或 http://qries.com  格式的 URL 地址。

<!DOCTYPE HTML>
<html>
   <body>
      <form action = "/cgi-bin/html5.cgi" method = "get">
         Enter URL : <input type = "url" name = "newinput" />
         <input type = "submit" value = "submit" />
      </form>
   </body>
</html>

相关文章