Hi.
I have the next problem:
1. I'm doing a select in a DB table and I'm displaying the result on a page
2. because one of this field is a comment and is too long, I display only the beginning of this folowed by "Read all" as a link.
3. when I press this link the DIV is pop up, but the contect of the div is not displayed...
Could you please tell me what I do wrong?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Participanti</title>
<script language="JavaScript1.2">
// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header
isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;
function ddInit(e){
topDog=isIE ? "BODY" : "HTML";
whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");
hotDog=isIE ? event.srcElement : e.target;
while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
}
if (hotDog.id=="titleBar"){
offsetx=isIE ? event.clientX : e.clientX;
offsety=isIE ? event.clientY : e.clientY;
nowX=parseInt(whichDog.style.left);
nowY=parseInt(whichDog.style.top);
ddEnabled=true;
document.onmousemove=dd;
}
}
function dd(e){
if (!ddEnabled) return;
whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
return false;
}
function ddN4(whatDog){
if (!isN4) return;
N4=eval(whatDog);
N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
N4.onmousedown=function(e){
N4.captureEvents(Event.MOUSEMOVE);
N4x=e.x;
N4y=e.y;
}
N4.onmousemove=function(e){
if (isHot){
N4.moveBy(e.x-N4x,e.y-N4y);
return false;
}
}
N4.onmouseup=function(){
N4.releaseEvents(Event.MOUSEMOVE);
}
}
function hideMe(){
if (isIE||isNN) whichDog.style.visibility="hidden";
else if (isN4) document.theLayer.visibility="hide";
}
function showMe(){
if (isIE||isNN) whichDog.style.visibility="visible";
else if (isN4) document.theLayer.visibility="show";
}
document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");
</script>
</head>
<body>
<table class="tab_blue" align="left" width="950">
<tr>
<td colspan="9" class="contactDept">Lista persoanelor ce s-au inscris pana astazi, <? echo date('d.m.Y')?></td>
</tr>
<tr>
<td class="contact" width="100">Nume</td>
<td class="contact" width="100">Nume de fata</td>
<td class="contact" width="100">Prenume</td>
<td class="contact" width="100">Localitatea</td>
<td class="contact" width="100">Telefon</td>
<td class="contact" width="100">Email</td>
<td class="contact" width="50">Numar persoane</td>
<td class="contact" width="50">Cazare (nopti)</td>
<td class="contact" width="250">Comentarii</td>
</tr>
<?
$cauta=mysql_query("select * from participanti order by `nume` ASC");
while ($rez=mysql_fetch_array($cauta)){
if($rez['arata']<>"1"){
?>
<tr>
<td class="contact" width="100"><? echo $rez['nume']?> </td>
<td class="contact" width="100"><? echo $rez['nume_inainte']?> </td>
<td class="contact" width="100"><? echo $rez['prenume']?> </td>
<td class="contact" width="100"><? echo $rez['localitate']?> </td>
<td class="contact" width="100">ascuns</td>
<td class="contact" width="100">ascuns</td>
<td class="contact" width="50"><? echo $rez['persoane']?> </td>
<td class="contact" width="50"><? echo $rez['cazare']?> </td>
<td class="contact" width="250">
<?
if(strlen($rez['comentarii'])>20){
echo substr($rez['comentarii'],1,20)."...";?><a href="#?id_com=<? echo $rez['id']?>" onclick="javascript:showMe();">[Read all]</a>
<?
} else {
echo $rez['comentarii'];
}
?>
</td>
</tr>
<?
} else {
?>
<tr>
<td class="contact"><? echo $rez['nume']?> </td>
<td class="contact"><? echo $rez['nume_inainte']?> </td>
<td class="contact"><? echo $rez['prenume']?> </td>
<td class="contact"><? echo $rez['localitate']?> </td>
<td class="contact"><? echo $rez['telefon']?> </td>
<td class="contact"><? echo $rez['email']?> </td>
<td class="contact"><? echo $rez['persoane']?> </td>
<td class="contact"><? echo $rez['cazare']?> </td>
<td class="contact">
<?
if(strlen($rez['comentarii'])>20){
echo substr($rez['comentarii'],1,20)."...";?><a href="#?id_com=<? echo $rez['id']?>" onclick="javascript:showMe();">[Read all]</a>
<? } else {
echo $rez['comentarii'];
}
?>
</td>
</tr>
<?
}
}
?>
</table>
<div id="theLayer" style="position:absolute; width:500px; left:270px; top:60px; visibility:hidden">
<table border="0" width="500" bgcolor="#66CC00" cellspacing="0" cellpadding="5" align="center">
<tr>
<td width="100%">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="36">
<tr>
<td width="100%">
<font face="Arial" color="#FFFFFF">Comentariu</font>
</td>
<td style="cursor:hand" valign="top" align="right">
<a href="#" onClick="hideMe();return false" style="text-decoration:none"><font color=#ffffff size=2 face=arial style="text-decoration:none;"><strong>X</strong></font></a>
</td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" style="padding:4px" colspan="2">
<!-- PLACE YOUR CONTENT HERE //-->
<?
$cauta_com = mysql_query("select * from participanti where id='$id_com'");
$coment=mysql_fetch_array($cauta_com);
echo $coment['comentarii'];
?>
<!-- END OF CONTENT AREA //-->
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>