<!DOCTYPE html>
<html lang="en-US">
<body>
<p>Click on the button, to switch the document from "left to right" and vice versa.</p>
<button onclick="myFunction()">Click Me</button>
<script>
document.dir="ltr";
function myFunction(){
if(document.dir == "ltr")
document.dir = "rtl";
else
document.dir = "ltr";
}
</script> </body>
</html>