代码编辑器:
x
1
主页: <input type="url" id="myURL" maxlength="30">
2
<p>点击按钮获取 URL 字段maxlength属性值</p>
3
<button onclick="myFunction()">点我</button>
4
<p id="demo"></p>
5
<script>
6
function myFunction() {
7
var x = document.getElementById("myURL").maxLength;
8
document.getElementById("demo").innerHTML = x;
9
}
10
</script>
11