แก้ไขโค้ด:
เห็นผล »
ลองตัวเอง - ©
w3ii.com
<
!DOCTYPE
html
>
<
html
>
<
body
>
<
p
id
="myP"
>
Click the button to change my text direction.
<
/p
>
<
button
onclick
="myFunction()"
>
Try it
<
/button
>
<
script
>
function
myFunction() {
document.getElementById(
"myP"
).dir =
"rtl"
;
}
<
/script
>
<
/body
>
<
/html
>
<!DOCTYPE html> <html> <body> <p id="myP">Click the button to change my text direction.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("myP").dir = "rtl"; } </script> </body> </html>