<html>
<body>
<h1>演示如何访问 URL 字段</h1>
首页:<input type="url" id="myURL" value="https://www.w3school.com.cn">
<p>单击该按钮可获取 URL 字段的 URL。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myURL").value;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>