JS 트래버스 페이지 제어,
다음과 같이 코드 코드를 복사하십시오.
var inputarr = document.forms [0];
for (var i = 0; i <inputarr.length; i ++) {
if (inputarr [i] .type.touppercase () == "버튼") {{) {{) {) {
inputarr [i] .disabled = "disabled";
} else if (inputarr [i] .type.toupperCase () == "file") {{
inputarr [i]. rreamonly = true;
}
}
다른 방법 :
다음과 같이 코드 코드를 복사하십시오.
var elements = document.getElementsByTagName_r ( "*");
VAR MSG;
var i;
(요소에서) {
if (요소 [i]. type == "text") {{
경고 (요소 [i] .Value);
}
}
JS 트래버스 제어 값
다음과 같이 코드 코드를 복사하십시오.
<doctype html public "-// w3c // dtd xhtml 1.0 transitional // en/tr/xhtml1/dtd/xhtml1-transitional.dtd">>
<html xmlns = "http://www.w3.org/1999/xhtml">
<헤드>
<title> js 트래버스 제어 값 </title>
<MCE : script type = "text/javaScript"> <!-
함수 제출 ()
{{
var text = document.getElementsByTagName ( "입력");
var array = "";
for (var i = 0; i <text.length; i ++)
{{
if (text [i] .type == "text"|| text [i] .epe == "checkbox")
{{
배열+= ",";;;
배열+= 텍스트 [i];
}
}
Array = array.substring (1, array.length);
경고 (배열);
}
// -> </mce : 스크립트>
</head>
<body>
<테이블>
<tr>
<td>
<input id = "checkbox1"type = "checkbox"value = "hu guo" /> hu guo < /td>
<td>
<입력 id = "text1"type = "text"value = "ws_hgo" /> < /td>
<td>
<입력 id = "button1"type = "button"value = "button"onclight = "제출 (this)" /> < /td>
</tr>
</테이블>
</body>
</html>
트래버스 페이지 텍스트 제어 코드
다음과 같이 코드 코드를 복사하십시오.
기능 텍스트 ()
{{
// var els = document.getElementSyTagName ( "*");
var els = document.getElementsByTagName ( "입력");
var msgs = "";
for (var i = 0; i <els.length; i ++)
{{
if (els [i] .type == "text")
{{
// 제어 ID를 가져옵니다
msgs + = els [i] .id + ",";;
}
}
경고 (MSG);
}