English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript에서 id 객체의 속성을 방식으로 속성에 접근하는 방법(예제 코드)

예제 다음과 같습니다:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>제목 없는 문서</title>
</head>
<body>
	<input type="text" value="저는 이긴다, 일억을 이겼다" id="mytext" />
	<script language="javascript">
		/*
		*	1mytext의 id를 가진 value 속성의 값을 가져오기 위해
		*  2mytext의 id를 가진 type 속성의 값을 가져오기 위해
		*/
		var txtElement = document.getElementById('mytext');
		//객체.속성을 통해 속성에 접근할 수 있습니다.
		alert(txtElement.value);
		alert(txtElement.type);
	</script>
</body>
</html>

이제 저는 여러분께 제공한 JavaScript에서 id 객체 속성을 접근하는 방법에 대한 모든 내용을 모두 다룬 것입니다. 많은 지원과 응원 부탁드립니다.呐喊 교본을 많이 읽어주세요~

추천 합니다