Return the font of a <p> element:
alert(document.getElementById("myP").style.font);
<!DOCTYPE html> <html> <body> <p id="myP" style="font:italic bold 30px Georgia,serif;">This is a paragraph.</p> <button type="button" onclick="myFunction()">Return font</button> <p id="demo"></p> <script> function myFunction() {/*w ww. java 2 s . com*/ document.getElementById("demo").innerHTML = document.getElementById("myP").style.font; } </script> </body> </html>