입력 URL 크기 속성은 입력 URL의 크기 속성을 반환/설정합니다. 정의되지 않은 경우 이 속성은 '20'을 반환합니다.
구문
다음은 구문입니다 -
- 반환되는 크기 속성
inputURLObject.size
- 크기 속성을 숫자로 설정
inputURLObject.size = number
예시
입력 URL 크기의 예를 살펴보겠습니다. 속성 -
<!DOCTYPE html>
<html>
<head>
<title>Input URL size</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>URL-size</legend>
<label for="URLSelect">URL:
<input type="url" id="URLSelect" size="10">
</label><br>
<input type="button" onclick="increaseVisibility()" value="Increase Visibility">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputURL = document.getElementById("URLSelect");
function increaseVisibility() {
inputURL.size = 30;
divDisplay.textContent = 'Visibility Increased to '+inputURL.size;
}
</script>
</body>
</html> 출력
이것은 다음과 같은 출력을 생성합니다 -
'가시성 증가'를 클릭하기 전에 버튼 -

'가시성 증가'를 클릭한 후 버튼 -
