HTML DOM DIR 속성
정의 및 사용
DIR은 속성 집합 또는 텍스트 요소의 방향을 돌려줍니다.
문법
HTMLElementObject.dir=text-direction
브라우저 지원
모든 주요 브라우저는 DIR 속성을 지원
예
예
본체 부재의 텍스트 방향을 반환
<html>
<body id="myid" dir="rtl">
<script>
var x=document.getElementsByTagName('body')[0];
document.write("Text direction: " + x.dir);
document.write("<br>");
document.write("An alternate way: ");
document.write(document.getElementById('myid').dir);
</script>
</body>
</html>
<body id="myid" dir="rtl">
<script>
var x=document.getElementsByTagName('body')[0];
document.write("Text direction: " + x.dir);
document.write("<br>");
document.write("An alternate way: ");
document.write(document.getElementById('myid').dir);
</script>
</body>
</html>
»시도