We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Have custom divs appear only at Forum Index
Topic Started: Mar 15 2010, 08:02 AM (488 Views)
cinnamonblue16
Member Avatar
Member
[ * ]
Board Address: My Test Board
Type of Request: Script

Description:
--I made a custom div in my test forum and I'm looking for a script or anything that would make it appear only on the forum index and have it hidden when you browse other parts of the forums. Is this possible?

Thank you in advance for anyone taking the time to help me~
Edited by cinnamonblue16, Mar 18 2010, 02:40 PM.
Offline Profile Goto Top
 
Deleted User
Deleted User

cinnamonblue16
Mar 15 2010, 08:02 AM
Board Address: My Test Board
Type of Request: Script

Description:
--I made a custom div in my test forum and I'm looking for a script or anything that would make it appear only on the forum index and have it hidden when you browse other parts of the forums. Is this possible?

Thank you in advance for anyone taking the time to help me~
Have a look at this from the database for if http://resources.zetaboards.com/topic/5076275/1/
Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code:
 
<div id="ioc"><div id="box">
<center>
THIS IS A DIV AND I WANT TO MAKE IT APPEAR ONLY AT THE INDEX AND HAVE IT HIDDEN WHEN ON OTHER PAGES OF THE FORUM
</center>
</div>
</div>
<script>
// Index Only Code (By Mwr247)
var iot=document.getElementById('ioc');
if(!location.href.match('idx')&&location.href.match('=')){
iot.innerHTML='';iot.style.display='none';}
</script>
I recommend this version. :)
Offline Profile Goto Top
 
cinnamonblue16
Member Avatar
Member
[ * ]
Woah that was fast! thanks a lot! I'll try it out now~
Offline Profile Goto Top
 
Deleted User
Deleted User

Cory
Mar 15 2010, 08:12 AM
Code:
 
<div id="ioc"><div id="box">
<center>
THIS IS A DIV AND I WANT TO MAKE IT APPEAR ONLY AT THE INDEX AND HAVE IT HIDDEN WHEN ON OTHER PAGES OF THE FORUM
</center>
</div>
</div>
<script>
// Index Only Code (By Mwr247)
var iot=document.getElementById('ioc');
if(!location.href.match('idx')&&location.href.match('=')){
iot.innerHTML='';iot.style.display='none';}
</script>
I recommend this version. :)
I thought that version was only for Zetaboards?
Goto Top
 
cinnamonblue16
Member Avatar
Member
[ * ]
^It seemed to work though. I'll try playing around with it some more.
Btw, does the code have to be specifically placed after the div?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
That's the InvisionFree version. Mike also made a ZetaBoards version. :)

The script may be placed in your Footer wrapper and the HTML can be placed wherever you'd like it to appear.
Offline Profile Goto Top
 
cinnamonblue16
Member Avatar
Member
[ * ]
Also I forgot to ask. Can I use the script for multiple divs? I just have to id them with "ioc" right?
It appears it only works for 1 div at a time. Can the code be tweaked for it?
Edited by cinnamonblue16, Mar 15 2010, 08:49 AM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Since an ID is unique, you can only use one HTML instance.
Quote:
 
<script type="text/javascript">
if(location.href.match('idx')&&location.href.match('=')){document.write('Index Only');}
</script>
That's another way to do it, but this requires more work. Be sure to use the proper quotation marks when using HTML (" instead of '). You also need to add a backslash (\) after each line of text to 'escape' the new-line characters, like so:
Quote:
 
<script type="text/javascript">
if(location.href.match('idx')&&location.href.match('=')){document.write('<div width="100%">Index Only</div>\
<strong>Bold Text</strong>');}
</script>
Offline Profile Goto Top
 
Reid
Member Avatar
È una trappola!

Completed!

Your code request has been completed.

Thank you for using our Member Request system here at Zathyus Networks Resources! If you have any questions regarding this topic, feel free to PM the code creator or post a new topic in the request forum. :)

Have a nice day!
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic