Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-17-2003, 09:19 AM   PM User | #1
Terence
New to the CF scene

 
Join Date: Apr 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Terence is an unknown quantity at this point
[urgent]how to change row color?

have a problem when making msg box.
The msgs are generated by "for loop".
if the user did not read the msg, the color of the row will be different (highlighted) from others.
now, i try to make an effect that the row color will be changed from white to lightgrey when the mouse pointer is moving over the row.
but the problem is the row color of a new msg will also change to white color when the pointer out of the row.
The new msg is not shown with the highlighted color again.

here is my code. can u help me?

...
<script language="javascript">
function over_bg (obj) {
obj.style.background="#E6E6E6";
}
function out_bg (obj) {
obj.style.background="";
}
</script>
....

<? for ($i = $no; $i > 0 ; $i--) { ?>
<tr onMouseOver="over_bg(this)" onMouseOut="out_bg(this)" <? If ($arr[$i][sstatus] == "new") { echo "style=\"background:#CECEFF\""; } ?>>
<td width="4%" height="25" align="center">
<input name="del[<?=$i?>]" type="checkbox" id="del[<?=$i?>]" value="<?=$arr[$i][msg_no]?>" <? If ($check == "all") { echo "checked"; }?>>
</td>
<td width="24%" align="left">
<a href="../member/member.php?user_no=<?=$arr[$i][receiver]?>">
<?=$arr[$i][nickname]?>
</a>¡@</td>
<td width="44%" align="left">
<a href="sent_msg.php?msgid=<?=$i?>">
<?=$arr[$i][title]?>
</a>¡@</td>
<td width="28%" align="left">
<? list($post_date, $time) = split( '[ ]', $arr[$i][post_date]);
echo $post_date;?>
¡@</td>
</tr>
<? } ?>
.......
Terence is offline   Reply With Quote
Old 04-17-2003, 09:49 AM   PM User | #2
Ökii
Regular Coder

 
Join Date: Jun 2002
Location: UK
Posts: 577
Thanks: 0
Thanked 0 Times in 0 Posts
Ökii is an unknown quantity at this point
extend your functions to take an additional parameter of colour hex value - actually you could easily combine them

function bg_swap( obj, hexref )
{
obj.style.background="#"+hexref;
}

then in the php

for(........)
$bg_ref = ($arr[$i][sstatus] == "new") ? 'CECEFF' : 'FFFFFF';
echo '<tr onMouseOver="bg_swap(this,\'E6E6E6\')" onMouseOut="bg_swap(this,\'' .$bg_ref. '\')" style="background:#' .$bg_ref. '">';

something like that anyway - flytyped so will probably need a bit more tinkering.
__________________
Ökii - formerly pootergeist
teckis - take your time and it'll save you time.
Ökii is offline   Reply With Quote
Old 04-17-2003, 12:26 PM   PM User | #3
Terence
New to the CF scene

 
Join Date: Apr 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Terence is an unknown quantity at this point
Thanks~

u're very helpful~
Terence is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 +1. The time now is 04:05 PM.


Advertisement
Log in to turn off these ads.