Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Design and Graphics Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2012, 04:35 PM
DFORMS DFORMS is offline
 
Join Date: Mar 2011
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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:



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!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:35 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.03003 seconds
  • Memory Usage 2,179KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete