Return the text alignment of a <p> element:
alert(document.getElementById("myP").style.textAlign);
<!DOCTYPE html> <html> <body> <p id="myP" style="text-align:right;">This is an example paragraph.</p> <button type="button" onclick="myFunction()">Return text alignment of p</button> <p id="demo"></p> <script> function myFunction() {//from w w w . j av a2 s . c om document.getElementById("demo").innerHTML = document.getElementById("myP").style.textAlign; } </script> </body> </html>