vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=253)
-   -   vBa alternate <td> background color (Javascript) (https://vborg.vbsupport.ru/showthread.php?t=288352)

DFORMS 09-26-2012 04:35 PM

vBa alternate <td> background color (Javascript)
 
Hi,

I'm currently running a phpBB forum (http://fragnet.ca/forum) and this is my index page (http://fragnet.ca). Recently I've been feeling limited and now I want to move to VB4. I've set up a VB test board with vBa as my index page (http://quebec-gamer.ca http://quebec-gamer.ca/forum). I want to have alternate background colors for some of my <td> on my index page. This is what it looks like on my current site:

http://quebec-gamer.ca/images/color_exemple.jpg

On my phpBB portal index page I have the following Javascript in my head tag:

Code:

<script type="text/javascript">
function alternate(id){
    if(document.getElementsByTagName){ 
        var table = document.getElementById(id);
        var rows = table.getElementsByTagName("tr");
        for(i = 0; i < rows.length; i++){       
            if(i % 2 == 0){
                rows[i].className = "even";
            }
                        else
                        {
                rows[i].className = "odd";
            }     
        }
    }
}
</script>


and the onload in my body tag:

Code:

onload="alternate('thetable');"

The tables are then tagged with id="thetable" and it works on my current website but I can't get it working on my vBa page. I tried adding the Javascript to the header template then the onload to the body tagged in the forumhome template and adding id="thetable" to the table tag in the adv_portal_module_wrapper but it's not working.

Any help with this would be greatly appreciated.

Thank you!

--------------- Added [DATE]1348759193[/DATE] at [TIME]1348759193[/TIME] ---------------

I am willing to pay for help.

--------------- Added [DATE]1348762620[/DATE] at [TIME]1348762620[/TIME] ---------------

OK, I found this simplified jquery version:

Code:

<script src="jquery.js"></script>

<script>
$(document).ready(function()
{
  //for table row
  $("#alternate:even").css("background-color", "#000000");
  $("#alternate:odd").css("background-color", "#ff0000");
});
</script>

and I got it to affect some parts of my site but it has zero effect on the vBa recent threads module : s !?

I added the id="alternate" to the <tr> tag but it doesn't work:

Code:

<tr id="alternate" class="vba_module" style="border-right: 0; border-left: 0;">
        <td class="blockrow" valign="top">
                <vb:if condition="$mod_options['portal_threads_newpostarrow'] AND $show['gotonewpost']">
                        <a href="{vb:raw vboptions.bburl}/{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_newpost}}"><img alt="{vb:rawphrase go_to_first_new_post}" src="{vb:stylevar imgdir_button}/firstnew.png" border="0" class="inlineimg" /></a>
                </vb:if>
                {vb:raw thread.prefix}
                <a href="{vb:raw vboptions.bburl}/{vb:link thread, {vb:raw thread}}" title="{vb:raw thread.preview}"<vb:if condition="$show['gotonewpost']"> style="font-weight: bold"</vb:if>><span style="font-weight: bold">{vb:raw thread.title}</span></a>
               
                <vb:if condition="$thread['rating']">
                        <br/>
                        <img src="{vb:stylevar imgdir_rating}/rating-trans-15_{vb:raw thread.rating}.png" alt="" />
                </vb:if>
               
                <vb:if condition="$mod_options['portal_threads_multipage'] AND $show['pagenav']">
                        <br/>
                        (<img class="inlineimg" src="{vb:stylevar imgdir_misc}/multipage.gif" border="0" alt="" /> {vb:raw thread.pagenav}<vb:if condition="$show['pagenavmore']">... <a href="{vb:raw vboptions.bburl}/{vb:raw thread.lastpagelink}">{vb:rawphrase last_page}</a></vb:if>)
                </vb:if>

                <vb:if condition="$show['lastpost']">
                    <br/>
                        {vb:raw thread.lastpostdate} <span class="time">{vb:raw thread.lastposttime}</span><br />
            </vb:if>
               
                <vb:if condition="$mod_options['portal_threads_threadstarter']">
                        <div>
                                <vb:if condition="$thread['postuserid']">
                                        {vb:rawphrase by_x, {vb:link member, {vb:raw thread}, null, 'postuserid', 'postusername'}, {vb:raw thread.postusername}}
                                <vb:else />
                                        {vb:rawphrase by} {vb:raw thread.postusername}
                                </vb:if>
                        </div>
                </vb:if>
        </td>

       
        <vb:if condition="$mod_options['portal_threads_replies']">
                <td align="center" class="blockrow">
                    {vb:raw thread.replycount}
                </td>
        </vb:if>
       
        <vb:if condition="$mod_options['portal_threads_views']">
                <td align="center" class="blockrow">
                    {vb:raw thread.views}
                </td>
        </vb:if>
       
        <vb:if condition="$mod_options['portal_threads_showforum']">
                <td class="blockrow" align="right">
                    <a href="{vb:raw vboptions.bburl}/{vb:link forum, {vb:raw thread}, null, 'forumid', 'forumtitle'}"><img src="images/statusicon/forum_{vb:raw thread.forumid}/forum_new-48.png" /></a>

                </td>
        </vb:if>
</tr>

Again I am very willing to pay via Paypal for support.

Thank you!


All times are GMT. The time now is 07:40 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01187 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete