Javascript examples for DOM:Element className
Get element class name
<html> <head> <title>Test Page</title> <script type="text/javascript"> window.onload = function () { console.log(document.getElementsByTagName("body")[0].className); };//from w w w . j a v a 2 s .c o m </script> <style type="text/css"> .testClass { color: green; background-color: red; } </style> </head> <body class="testClass"> <p>Test Content</p> </body> </html>