document.getElementById() - 버튼 클릭시 style 적용
페이지 정보
본문
<script>
function change(){
var span2 = document.getElementById("mySpan");
span2.style.color = "green";
span2.style.fontSize = "30px";
span2.style.border = "3px dotted magenta";
span2.style.margin = "30px";
}
</script>
<h3>css3 스타일 동적 변경</h3>
<hr>
<p style="color:blue">
이것은 <span id="mySpan" style="color:red">문장입니다.</span>
</p>
<input type="button" value="스타일 변경" onclick="change()">
추천0 비추천0
- 이전글● document.getElementById() - style 적용 21.07.18
- 다음글■ HTML DOM 객체란? 21.07.17
댓글목록
등록된 댓글이 없습니다.