Как скрыть часть текста с помощью спойлера
- Код:
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">
Подробнее : <input onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Скрыть'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Показать'; }" style="font-size: 10px; margin: 0px; padding: 0px; width: 60px;" type="button" value="Показать" /> </div>
<div class="alt2" style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-size: auto auto; background-attachment: scroll; background-color: whitesmoke; background-image: none; background-position: 0% 50%; background-repeat: repeat; border: 1px inset; line-height: 1.5em; margin: 0px; padding: 6px;">
<div style="display: none;">
Текст, который нужно скрыть
<br/>
</div>
</div>
</div>
Пример работы спойлера
После слова Подробнее кнопка Показать.