Hallo zusammen,
ich würde gerne eine Zeile meiner Tabelle mit einer anderen Hintergrundfarbe belege, dies eben markieren. und beim erneuten daraufklicken wieder die ursprügnliche Farbe bekommen!
habe es mit versucht aber klappt leider nicht.
Hier die Komplette datei
Code:
<?PHP
session_start();
include("mysqlcon.inc.php");
include("config.inc.php");
echo"<HTML>
<HEAD>
<TITLE>seeavis</TITLE>
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
<script language=javascript>
<!--\";
function marker()
{
if(this.style.backgroundColor=='#33FF66')
{
this.style.backgroundColor='#000000';
}else{
this.style.backgroundColor=='#33FF66';
}
}
function delcheck(avisindex)
{
if (confirm('Wollen sie wirklich löschen ?')==true)
{
self.location.href='del.php?index='+avisindex;
}
}
</script>
</HEAD>
<BODY bgcolor=\"#F5F5F5\">";
$aktuel_datum=0;
$aktuel_kw=0;
$countspalten=count(explode(",",$s_spaltenindex))+2;
$spalten_array=(explode(",",$s_spaltenindex));
///////////////////////////////////////////////////
////////////MySQL-Select///////////////////////////
///////////////////////////////////////////////////
//desc = Datum absteigend
if ($s_lager=='Alle')
{
$query = "SELECT * from avisliste WHERE datum<='$s_aktdate' and datum>='$s_lastdate' and trashed='0' order by datum asc";
}
else
{
$query = "SELECT * from avisliste WHERE datum<='$s_aktdate' and datum>='$s_lastdate' and lager='$s_lager' and trashed='0' order by datum desc";
}
$sql_query = mysql_query($query);
if (mysql_errno()) die ("MySQL-Error: ".mysql_error());
///////////////////////////////////////////////////
////////////Tab Überschriften//////////////////////
///////////////////////////////////////////////////
echo"<table align=\"center\" border=\"0\" bgcolor=\"#F5F5F5\"><tr bgcolor=\"#D3DCE3\"><tr>";
if($s_rechte==1)
{
echo"<td></td>";
}
foreach($spalten_array as $x)
{
$colname=mysql_field_name($sql_query,$x);
echo"<td><font color=\"black\" size=\"4\">Â*$colnameÂ*</font></td>";
}
echo"</tr>";
///////////////////////////////////////////////////
////////////Tab Aviseinträge //////////////////////
///////////////////////////////////////////////////
echo"<tr>";
while ($row=mysql_fetch_array($sql_query))
{
extract($row);
if ($aktuel_datum!=$Datum and $aktuel_datum!=0)
{
echo"<tr><td colspan=\"$countspalten\" bgcolor=\"#F5F5F5\">Â*</td></tr>";
$aktuel_datum=$Datum;
}
else
{
$aktuel_datum=$Datum;
}
echo"<tr bgColor=\"$color\"
onmouseclick=\"javascript:marker()\"
onmouseover=\"this.style.backgroundColor='#33FF66';\" onmouseout=\"this.style.backgroundColor='$color';\">";
if($s_rechte==1)
{
echo"<td><input type=\"button\" name=\"edit\" value=\"Bearb.\" onclick=\"self.location.href='edit.php?index=$avis_id '\"></td>";
}
foreach($spalten_array as $x)
{
$colname=mysql_field_name($sql_query,$x);
if($s_layout=='1')
{
if($colname!='Datum')
{echo"<td><div id=\"box\"><a href=\"#\">Â*{$row[$x]}Â*<span>$colname</span></a></td>";}
else
{echo"<td><div id=\"box\"><a href=\"#\"><font color=\"blue\">Â*{$row[$x]}Â*</font><span>$colname</span></a></td>";}
}
if($s_layout=='2')
{
if($colname!='Datum')
{echo"<td>Â*{$row[$x]}Â*</td>";}
else
{echo"<td><font color=\"black\">Â*{$row[$x]}Â*</font></td>";}
}
}
echo"</td>";
///////////////////////////////////////////////////
////////////Edit,Del,New Buttons///////////////////
///////////////////////////////////////////////////
if($s_rechte==1)
{
echo"
<td><input type=\"button\" name=\"del\" value=\"X\" onclick=\"delcheck($avis_id)\"></td>
</tr>";
}
}
echo"</table>";
?>
</BODY>
</HTML>
das Javascript sieht dann so aus
Code:
function marker()
{
if(this.style.backgroundColor=='#33FF66')
{
this.style.backgroundColor='#000000';
}else{
this.style.backgroundColor='#33FF66';
}
}
und der aufruf soll in jeder Zeile der Tabelle sein.
Code:
echo"<tr bgColor=\"$color\"
onmouseclick=\"javascript:marker()\"
onmouseover=\"this.style.backgroundColor='#33FF66';\" onmouseout=\"this.style.backgroundColor='$color';\">";
Leider passiert beim auruf, garnix!
Könnt ihr mir helfen ?
BIG THX
Christian