...

View Full Version : TUT: Spoilers for HTML



williamsoft1
06-04-2012, 11:15 AM
After searching the web for hours with little to no results, I finally found a nice peice of code that done the trick with a bit of twaeking.

Here is the result we will be looking for:

http://www.codingforums.com/attachment.php?attachmentid=11249&stc=1&d=1338804153

the code behind it is pretty simple, but contains a little bit of javascript:


<div class="pre-spoiler">
<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 = 'Hide Update'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Show Update';}" style="font-size: 10px; margin: 0px; padding: 0px; width: 140px;" type="button" value="Show Update" />
</div>
<div>
<div class="spoiler" style="display: none;">
PLACE YOUR CONTENT HERE
</div></div>

The code does need cleaning up, and I will revisit it later but it gets the job done.

Hope you find it useful.

EDIT: Just noticed this was moved, thanks to whoever moved it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum