<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div id="demo">Hello CSS World</div>
<br>
<button onclick="func()">적용</button>
<script>
function func() {
obj = document.getElementById("demo");
obj.style.color = "white";
obj.style.backgroundColor = "blue";
obj.style.textAlign = "center";
obj.style.borderStyle = "double";
obj.style.borderColor = "red";
obj.style.fontFamily = "MS PGothic";
obj.style.fontStyle = "italic";
obj.style.fontSize = "24pt";
}
</script>
</body>
</html>
반응형
'JavaScript > javascript 기초 공부하기' 카테고리의 다른 글
자바스크립트 내장 함수 정리 (forEach, map, indexOf, findIndex, find, filter, splice, slice, concat, join, reduce) (1) | 2020.01.19 |
---|---|
자바스크립트 반복문 정리 (for of, for in, Object.entries,keys,values) (0) | 2020.01.19 |
마우스 이벤트, 키보드 이벤트 (0) | 2020.01.07 |
history, location 활용하기 (0) | 2020.01.07 |
자바스크립트 10진법 2, 8, 16진법으로 변환하기 (0) | 2020.01.07 |