length 속성을 가진 대상
1425 단어 length
주요 브라우저는length 속성과 window를 지원합니다.frame.length 속성의 값은 같습니다.
<script type="text/javascript">
alert(window.length);//"3"
alert(window.frame.length);//"3"
</script>
<body>
<iframe src="http://microsoft.com"></iframe>
<iframe src="http://www.w3school.com.cn/index.html"></iframe>
<iframe src="http://www.baidu.com"></iframe>
</body>
2. function 함수에서 원하는 매개 변수의 개수입니다.기본적으로 예상되는 매개 변수의 개수를 보기 위한 간편한 방법이 있습니다.
function testplus(i) {
alert(i*i);
}
function sayHello() {
alert("Hello!");
}
alert(testplus.length); // , "1"
alert(sayHello.length); // , "0"
3. array 는 배열의 요소 수를 설정하거나 반환합니다.
<script type="text/javascript">
function getElements()
{
var x=document.getElementsByTagName("input");//
alert(x.length);//"1"
}
</script>
<input type="button" onclick="getElements()" />
4.string은 문자열의 길이를 계산합니다.
var txt="Hello World!";
alert(txt.length);//"12"
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Java32 String클래스String클래스 = char[] + 메서드기능 (char배열..char를 여러개 만든것이 String) String 클래스는 내용을 변경할 수 없다 - 읽기만 가능...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.