개발하자/자바스크립트
배열로 접근해서 버튼색바꾸기 document.forms[0].elements[0]
i구야
2015. 2. 28. 10:43
<html>
<head>
<style type="text/css">
</style>
<script>
window.onload=function(){
document.forms[0].elements[0].style.background="red";
document.forms[0].elements[1].style.background="blue";
document.forms[1].elements[0].style.background="yellow";
}
</script>
</head>
<body>
<form>
<input type="button">
<input type="button">
</form>
<form>
<input type="button">
</form>
</body>
</html>