DeathStar Posted March 22, 2007 Share Posted March 22, 2007 Hi there.. This managed to work fine in html but now that I have put it in a php file it does not work. Supposed to change cell's color onmouseover but not doing anything.. here is the code <style type='text/css'> tr.off { background: #CCCCCC; } tr.on { background: #FF0000; } </style> <table width='533' height='21' border='0' align='center' cellpadding='0' cellspacing='1' bordercolor='#000000' bgcolor='#FF0000'> <tr> <td width='100'><div align='center'><span class='style5'>Name</span></div></td> <td width='200'><div align='center'><span class='style5'>Reson</span></div></td> <td width='80'><div align='center'><span class='style5'>Status</span></div></td> <td width='120'><div align='center'><span class='style5'>E-mail</span></div></td> <td width='120'><div align='center'><span class='style5'>**</span></div></td> <td width='60'><div align='center'><span class='style5'>**</span></div></td> <td width='80'><div align='center'><span class='style5'>**</span></div></td> </tr><tr class='off' onmouseover='this.className='on'' onmouseout='this.className='off''> Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/ Share on other sites More sharing options...
Orio Posted March 22, 2007 Share Posted March 22, 2007 I don't see any PHP... Notice this will confuse the browser: onmouseover='this.className='on'' onmouseout='this.className='off'' Change it to something like this: onmouseover="this.className='on'" onmouseout="this.className='off'" Orio. Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212768 Share on other sites More sharing options...
DeathStar Posted March 22, 2007 Author Share Posted March 22, 2007 just put echo " and "; on... if i do put "'s on it will give a phrase error! Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212769 Share on other sites More sharing options...
kenrbnsn Posted March 22, 2007 Share Posted March 22, 2007 Please post the PHP code where this is being used. Ken Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212770 Share on other sites More sharing options...
Orio Posted March 22, 2007 Share Posted March 22, 2007 If you want to echo a double quote inside echo "";, you need to escape it: Example: <?php echo "\""; //output- a double quote ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212771 Share on other sites More sharing options...
DeathStar Posted March 22, 2007 Author Share Posted March 22, 2007 <?php session_start(); require "connect.php"; $by = "sid"; $ord = ($_GET['ord']); $cnt = mysql_query("SELECT sid FROM spammers"); $membs = mysql_num_rows($cnt); $pages = (int)($membs / 100) + 1; if ($membs % 100 == 0) { $pages--; } print "<title>{$_SERVER['SCRIPT_NAME']}</title> <style type='text/css'> .style5 {color: #000000; font-weight: bold; font-family: Arial; } body { background-color: #000000; background-image: url(); } tr.off { background: #CCCCCC; } tr.on { background: #FF0000; } </style><p align='center'><img src='lgo.png' alt='loading..' width='600' height='200' /></p>"; print "<center><font color=white>Pages:</font> "; for ($i = 1; $i <= $pages; $i++) { $stl = ($i - 1) * 100; print "<a href='index.php?st=$stl&by=$by&ord=$ord'>$i</a> "; } print "<br /> <center><font color=white>Order By: <a href='index.php?by=username&ord=$ord'>Username</a><br> <a href='index.php?ord=asc'>Ascending</a> | <a href='index.php?ord=desc'>Descending</a><br /><br />"; $sm=mysql_query("SELECT * FROM spammers ORDER BY $by $ord LIMIT 100"); $no1 = $st + 1; $no2 = $st + 100; print "<font color=white>Showing $no1 to $no2 by order of $by $ord. <table width='533' height='21' border='0' align='center' cellpadding='0' cellspacing='1' bordercolor='#000000' bgcolor='#FF0000'> <tr> <td width='100'><div align='center'><span class='style5'>Name</span></div></td> <td width='200'><div align='center'><span class='style5'>Reson</span></div></td> <td width='80'><div align='center'><span class='style5'>Status</span></div></td> <td width='120'><div align='center'><span class='style5'>E-mail</span></div></td> <td width='120'><div align='center'><span class='style5'>IP</span></div></td> <td width='60'><div align='center'><span class='style5'>Date</span></div></td> <td width='80'><div align='center'><span class='style5'>Links</span></div></td> </tr>"; while ($s=mysql_fetch_array($sm)) { print "<tr class='off' onmouseover='this.className='on'' onmouseout='this.className='off''> <td>".$s['name']."</td> <td>".$s['reson']."</td>"; if ($s['status'] == 0){ print "<td bgcolor=white>None</td>";} elseif ($s['status'] == 1){ print "<td bgcolor=yellow>Abuser</td>";} elseif ($s['status'] == 2){ print "<td bgcolor=orange>Beware</td>";} elseif ($s['status'] == 3){ print "<td bgcolor=red>Ban</td>";} echo "<td>".$s['email']."</td> <td>".$s['ip']."</td> <td>".$s['date']."</td> <td><a href='http://www.google.com/search?q={$s['name']}' target='_new'>Google</a></td> </tr>"; } print "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212772 Share on other sites More sharing options...
Orio Posted March 22, 2007 Share Posted March 22, 2007 As I already said, use escaped double quotes: <?php print "<tr class='off' onmouseover=\"this.className='on'\" onmouseout=\"this.className='off'"> <td>".$s['name']."</td> <td>".$s['reson']."</td>"; ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212775 Share on other sites More sharing options...
DeathStar Posted March 22, 2007 Author Share Posted March 22, 2007 and while you posted.. Got it... Thanks Orio and kenrbnsn Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212777 Share on other sites More sharing options...
trq Posted March 22, 2007 Share Posted March 22, 2007 "<tr class='off' onmouseover='this.className=\"on\"' onmouseout='this.className=\"off\"'> Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212778 Share on other sites More sharing options...
DeathStar Posted March 22, 2007 Author Share Posted March 22, 2007 and thorpe.. Quote Link to comment https://forums.phpfreaks.com/topic/43831-solved/#findComment-212780 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.