What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Javascript spoiler tag help (solved + added final code)

Javascript spoiler tag help (solved + added final code)
Author: Message:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: Javascript spoiler tag help
Changed to classes

I'm now using this:
code:
<script>
   function hide(id){
      document.getElementById(id).style.display = 'none';
   }   
   function show(id){
      document.getElementById(id).style.display = '';
   }
   function spoilerhide(){
      for (i=0;i<document.getElementsByTagName('div').length;i++) {
         if (document.getElementsByTagName('div')[i].class == 'spoiler') {
            document.getElementsByTagName('div')[i].style.color = '#000000';
         }
      }
   }
   function spoilershow(){
      for (i=0;i<document.getElementsByTagName('div').length;i++) {
         if (document.getElementsByTagName('div')[i].class == 'spoiler') {
            document.getElementsByTagName('div')[i].style.color = '#FF0000';
         }
      }
   }
</script>
<div id="div1">
    <input type="button" onClick="hide('div1'); show('div2'); spoilershow();" value="Laat spoilers zien">
</div>
<div id="div2" style="display:none;">
    <input type="button" onClick="show('div1'); hide('div2'); spoilerhide();" value="Verberg spoilers">
</div>

But it still doesn't work, and with
code:
if (document.getElementsByTagName('div')[i].class = 'spoiler')
instead of
code:
if (document.getElementsByTagName('div')[i].class == 'spoiler')

It makes all div's white and black :S
[Image: 1-0.png]
             
03-01-2006 10:42 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Javascript spoiler tag help (solved + added final code) - by Ezra on 03-01-2006 at 08:06 PM
RE: Javascript spoiler tag help - by matty on 03-01-2006 at 08:08 PM
RE: Javascript spoiler tag help - by wj on 03-01-2006 at 08:09 PM
RE: Javascript spoiler tag help - by Ezra on 03-01-2006 at 08:13 PM
RE: Javascript spoiler tag help - by wj on 03-01-2006 at 08:15 PM
RE: Javascript spoiler tag help - by WDZ on 03-01-2006 at 08:22 PM
RE: Javascript spoiler tag help - by Ezra on 03-01-2006 at 08:25 PM
RE: Javascript spoiler tag help - by matty on 03-01-2006 at 09:49 PM
RE: Javascript spoiler tag help - by wj on 03-01-2006 at 10:06 PM
RE: Javascript spoiler tag help - by ShawnZ on 03-01-2006 at 10:18 PM
RE: Javascript spoiler tag help - by Ezra on 03-01-2006 at 10:42 PM
RE: Javascript spoiler tag help - by Plik on 03-01-2006 at 10:55 PM
RE: Javascript spoiler tag help - by Ezra on 03-01-2006 at 11:01 PM
RE: Javascript spoiler tag help - by Plik on 03-01-2006 at 11:06 PM
RE: Javascript spoiler tag help - by Ezra on 03-01-2006 at 11:08 PM
RE: Javascript spoiler tag help - by Plik on 03-01-2006 at 11:13 PM
RE: Javascript spoiler tag help - by Ezra on 03-01-2006 at 11:16 PM
RE: Javascript spoiler tag help - by Plik on 03-01-2006 at 11:20 PM
RE: Javascript spoiler tag help - by Ezra on 03-02-2006 at 12:03 AM
RE: Javascript spoiler tag help (solved + added final code) - by ShawnZ on 03-02-2006 at 12:31 AM
RE: Javascript spoiler tag help (solved + added final code) - by -dt- on 03-02-2006 at 02:54 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On