<html>
<body>
<p>单击该按钮以创建一个 URL 字段。</p>
<button onclick="myFunction()">试一试</button>
<script>
function myFunction() {
var x = document.createElement("INPUT");
x.setAttribute("type", "url");
x.setAttribute("value", "http://www.google.com");
document.body.appendChild(x);
}
</script>
</body>
</html>