I'm new in javascript and I found this sample code :
HTML :
<div id="newpost">
Test text
</div>
<button id='button'>Click</button>
JavaScript :
var button = document.getElementById('button');
button.onclick = function() {
var div = document.getElementById('newpost');
if (div.style.display !== 'none') {
div.style.display = 'none';
}
else {
div.style.display = 'block';
}
};
Demo : http://jsfiddle.net/andrewwhitaker/hefGK/
My question is : how can I add some effects to this code ?