#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    9
    Rep Power
    0

    Question A "spoiler tag"-like function that works in eg emails, blog comments, etc: Possible?


    I expected that there might be a standard HTML tag that actually had this function built-in, but I haven't been able to google up anything like that...

    The initial google just turned up stuff like the following, so I'm guessing it's just not possible?

    Code:
    <html>
    <head>
    	<title>Spoiler HTML code</title>
    	<style type="text/css">
    body,input
    	{
    	font-family:"Trebuchet ms",arial;font-size:0.9em;
    	color:#333;
    	}
    .spoiler
    	{
    	border:1px solid #ddd;
    	padding:3px;
    	}
    .spoiler .inner
    	{
    	border:1px solid #eee;
    	padding:3px;margin:3px;
    	}
    	</style>
    	<script type="text/javascript">
    function showSpoiler(obj)
    	{
    	var inner = obj.parentNode.getElementsByTagName("div")[0];
    	if (inner.style.display == "none")
    		inner.style.display = "";
    	else
    		inner.style.display = "none";
    	}
    	</script>
    </head>
    <body>
    <h1>Spoiler HTML w/Js Code by Skrap</h1>
    <div class="spoiler">
    	<input type="button" onclick="showSpoiler(this);" value="Show/Hide" />
    	<div class="inner" style="display:none;">
    	This is a spoiler!
    	</div>
    </div>
    </body>
    </html>
    Last edited by Owen_R; February 18th, 2013 at 12:41 AM. Reason: typo
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    There isn't a tag like that. You might be able to build something similar with just CSS, but very few blog commenting systems allow you to post HTML.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo