Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Deko

Deko Avatar

****
Senior Member

452


October 2005
..I need a lil help.

Alright so I made this code for my forum. It puts the post text in a speech bubble. Works fine except the part that changes the font color within the bubble.

<script type="text/javascript">
<!--
//For use on KAI-KANJI ONLY
//By Xero.Infection aka Deko
var XI=document.getElementsByTagName('td')
for (k=0;k<XI.length;k++) {
if (XI[k].className.match(/windowbg/i) && XI[k].width=="80%" && XI[k].height=="100%" && XI[k].align == "left"){
XI[k+4].getElementsByTagName("HR")[0].style.display = "none";
XI[k+4].getElementsByTagName("FONT")[0].className = "sbtext";
XI[k+4].innerHTML = "<table width='100%' cellpadding='0' cellspacing='0'><tr><td valign='top' width='1%'><BR><img src='http://members.cox.net/kai-kanji/forum/rounds/arw.png'></td><td width='99%' class='speechbubble'>"+XI[k+4].innerHTML+"</td></tr></table>";
}}
//-->
</script>


Right now I'm using this portion to edit the text color (with a bit of CSS in the header):
XI[k+4].getElementsByTagName("FONT")[0].className = "sbtext";

Problem is, when there are lists in the posts like here:
kaikanjiforum.proboards.com/index.cgi?board=newsbulletin&action=display&thread=519

All the text in the list and any text thereafter goes to the forum default text color. I'm sure there's a way to fix that? Also, if there's a better way to grab the post text I'd like to know. Pliss halp ^^

Chris

Chris Avatar

******
Head Coder

19,519


June 2005

XI[k+4].getElementsByTagName("FONT")[0].parentNode.className = "sbtext";

Try that. Basically, any time a list, quote, or table is used, it has a </font> and then a new <font> afterwards... so, that means that you only set the first one, not the new second and third, etc.

Deko

Deko Avatar

****
Senior Member

452


October 2005
Hmm I tried it, it didn't work. :-/ This would effect anything inside of a tag though? Is there a way to search for an exact hex color and change it to a color I designate?

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Well, I don't remember how the HTML changes exactly, and it also depends on your CSS. Wanna post that? :P

Deko

Deko Avatar

****
Senior Member

452


October 2005
Ah, I'm dumb.. I've fixed it I think.

This is what I had:
.speechbubble{background-color: #4b6875; -moz-border-radius: 8px 8px 8px 8px; padding: 10px 10px 20px 10px;}
.sbtext{color: #a9b3b9;}


One for the table, the other for the text.
I moved "color: #a9b3b9;" to .speechbubble, which seems to be working.


Last Edit: Sept 13, 2010 16:23:15 GMT by Deko

newBookmarkLockedFalling