ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: HTML DOM dirÊôÐÔ

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

HTML DOM dirÊôÐÔ


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-28 ä¯ÀÀ:2285 :: ::

Definition and Usage
¶¨ÒåÓëÓ÷¨

The dir property sets or returns the text-direction for an element.
dirÊôÐÔ¿ÉÉèÖûò·µ»ØÄ³ÔªËØÎÄ×ֵķ½Ïò

Syntax
Óï·¨

object.dir=text-direction


Example
¾ÙÀý

The following example shows two methods on how to get the text direction for the <body> element:
¾ÙÀýÖн«Õ½Ê¿Á½ÖÖ·½·¨À´µÃµ½<body>ÔªËØÖÐÎÄ×ֵķ½Ïò£º

<html>
<body id="myid" dir="rtl">
<script type="text/javascript">
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>

Output:
Êä³ö½á¹û£º

Text direction: rtl
An alternate way: rtl


Try-It-Yourself Demos

Return the text direction for the <body> element
·µ»Ø<body>ÔªËØÄÚÎÄ×ֵķ½·¨

ÆÀÂÛ (0) All