dir 예제 - 쓰기방향 설정
<p id="hz">홈짱닷컴 Homzzang.com</p> <button onclick="homzzang()">클릭</button> <script> function homzzang() { document.getElementById("hz").dir = "rtl"; } </script> 결과보기
<p id="hz">홈짱닷컴 Homzzang.com</p>
<button onclick="homzzang()">클릭</button>
<script>
function homzzang() {
document.getElementById("hz").dir = "rtl";
}
</script>
결과보기
dir 예제 - 쓰기방향 반환
<p id="hz" dir="rtl">홈짱닷컴 Homzzang.com</p> <button onclick="homzzang()">클릭</button> <p id="demo"></p> <script> function homzzang() { var x = document.getElementById("hz").dir; document.getElementById("demo").innerHTML = x; } </script> 결과보기
<p id="hz" dir="rtl">홈짱닷컴 Homzzang.com</p>
<p id="demo"></p>
var x = document.getElementById("hz").dir;
document.getElementById("demo").innerHTML = x;