Javascript examples for DOM:Element getAttribute
Pass a CSS style class as a parameter to function
<html> <head> <style rel="stylesheet"> .A { border: 1px solid red; background-color: white } </style> <script> function clicked(c) {//from ww w . ja va2s . co m console.log(c); } </script> </head> <body> <input type="button" class="A" value="1" onclick="clicked(this.getAttribute('class'))"> </body> </html>