Copyright © tutorialspoint.com
This method modifies element's CSS style properties. Styles are passed as a hash of property-value pairs in which the properties are specified in their camelized form.
element.setStyle(styles); |
<html> <head> <title>Prototype examples</title> <script type="text/javascript" src="/javascript/prototype.js"> </script> <script> function setColor() { $('test').setStyle({ backgroundColor: '#900', fontSize: '12px' }); } </script> </head> <body"> <p id="test">Click the button to see the result.</p> <input type="button" value="Click" onclick="setColor();"/> </body> </html> |
To understand it in better way you can Try it yourself.
Copyright © tutorialspoint.com