HTML DOM reż atrybutu
Definicja i Wykorzystanie
zestawy własności dir lub zwraca kierunek elementów tekstowych.
gramatyka
HTMLElementObject.dir=text-direction
Pomoc Browser
Wszystkie główne przeglądarek obsługuje atrybutu dir
Przykłady
Przykłady
Zwraca kierunek tekstu elementu nadwozia:
<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>
Spróbuj »