我需要一些帮助来获得一个jQuery单击功能,以便为我使用PHP while循环输出的所有项目工作。它只适用于第一个循环。
我需要打开一个弹出窗口,在用户触发点击功能时向用户显示一条消息。
PHP:
<?php
$query = mysql_query("SELECT * FROM message WHERE to_mem='$from_mem' AND
to_mem_burn='2' AND new_message='3' ORDER BY id DESC");
$num_rows = mysql_num_rows($query);
if ($num_rows < 1) {
echo '<div id="new_message" class="addlinkuplinks a"> You have no
message at this time. </div>';
} else {
while($row = mysql_fetch_array($query)){
$msg_id = $row['id'];
$msg_to_mem = $row['to_mem'];
$msg_from_mem = $row['from_mem'];
$msg_from_memID = $row['from_memID'];
$msg_subject = $row['subject'];
$msg_content = $row['content'];
$msg_date = $row['date'];
$msg_from_mem_burn = $row['from_mem_burn'];
$msg_to_mem_burn = $row['to_mem_burn'];
$sqlName=mysql_query("SELECT * FROM members WHERE email<>'$from_mem'
AND email='$msg_from_mem' LIMIT 1")or die ("Sorry we have a mysql error!");
while($row=mysql_fetch_array($sqlName)){
$msg_from_memAccount=$row["accountType"];
$msg_from_memID=$row["hdw_id"];
$msg_from_memfirstName=$row["firstName"];
$msg_from_memlastName=$row["lastName"];
$msg_from_mem_pic=$row["profile_pic"];
$gender=$row["gender"];
}
echo '
<div id="linkUPmsg" class="linkUPmsg">
<table width="100%">
<tr>
<tr><td width="60%"align="left" valign="top"><span style="font-size:
12px; color: #CCCCCC;">Read Date:</span></td>
<td width="40%"align="right" valign="top"><span style="font-size: 12px; color:
#CCCCCC;">'.$msg_date.'</span></td>
</tr>
<table width="100%">
<tr>
<td width="5%" align="left">'.$profile_pic.'</td>
<td width="87%"align="left" ><span style="font-size: 14px; font-
weight: bold; color:#999999;">'.$msg_from_memfirstName.'
'.$msg_from_memlastName.'</span>
<div id="requestlinkUP_text">Send you this message!</div>
<div id="requestlinkUP_text"">Subject: <span style="font-size: 12px;
font-weight: bold; color: #0066CC;">'.$msg_subject.'</span></div>
</td>
<div id="member_msg"></div>
<td width="3%" align="right"><div id="linkUPmsg_read"
class="msgAction"">
<a href="#"><img src="/image/read_mail.png" width="41"
height="27" /></a>
</div>
<div id="popupboxrContact">
<div id="memberslinkup" class="msgdiv"></div>
<div id="formbox" class="form_border" >
<div class="tittle_border"><table width="100%" bgcolor="#F30"
style="opacity: 0.7;">
<tr>
<td>
<a id="popupboxrContactClose" class="popupboxClose">Close</a>
<span style="text-align: center; font-size: 18px; font-weight: bold; color:
#CCC;">Reading Message</span></td>
</tr>
</table></div><p></p>
<p></p>
<table width="100%">
<tr>
<tr><td width="60%"align="left" valign="top"><span style="font-size:
12px; color: #CCCCCC;">Read Date:</span></td>
<td width="40%"align="right" valign="top"><span style="font-size: 12px; color:
#CCCCCC;">'.$msg_date.'</span></td>
</tr>
<table width="100%">
<tr>
<td width="5%" align="left">'.$profile_pic.'</td>
<td width="87%"align="left" ><span style="font-size: 14px; font-
weight: bold; color: #999999;">'.$msg_from_memfirstName.'
'.$msg_from_memlastName.'</span>
<div id="requestlinkUP_text">Send you this message!</div>
<div id="requestlinkUP_text"">Subject: <span style="font-size: 12px;
font-weight: bold; color: #0066CC;">'.$msg_subject.'</span></div>
</td>
</tr>
</table>
</div>
</div>
<div id="bgPopupboxr"></div>
</td>
<div id="member_msg"></div>
<td width="3%" align="right"><div id="linkUPmsg_read"
class="addlinkuplinks"><form id="readForm" action="" class="form" method=""
enctype="multipart/form-data" name="acceptlinkUP">
<input name="read_linkUPmsg" class="msgAction" type="image"
src="/image/mail_reply.png" /></form></div></a>
</td>
<div id="member_msg"></div>
<td width="2%" align="right"><div id="linkUPmsg_burn"
class="addlinkuplinks"><form id="burnForm" action="/burn_message.php" class="form"
method="get" enctype="multipart/form-data" name="burnlinkUP">
<input name="msg_id" type="hidden" value="'.$msg_id.'" />
<input name="to_mem" type="hidden" value="'.$msg_from_mem.'" />
<input name="burn_linkUPmsg" class="msgAction" type="image"
src="/image/burn_sign.png" />
</form></div></a>
</td>
</tr>
</table>
</span>
</div>
';
}
}
?>
jQuery的:
var popupboxrStatus = 0;
function loadPopupboxr(){
if(popupboxrStatus==0){
$("#bgPopupboxr").css({
"opacity": "0.4"
});
$("#bgPopupboxr").fadeIn("slow");
$("#popupboxrContact").fadeIn("slow");
popupboxrStatus = 1;
}
}
function disablePopupboxr(){
if(popupboxrStatus==1){
$("#bgPopupboxr").fadeOut("slow");
$("#popupboxrContact").fadeOut("slow");
popupboxrStatus = 0;
}
}
function centerPopupboxr(){
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupboxrHeight = $("#popupboxrContact").height();
var popupboxrWidth = $("#popupboxrContact").width();
$("#popupboxrContact").css({
"position": "absolute",
"top": windowHeight/2-popupboxrHeight/2,
"left": windowWidth/2-popupboxrWidth/2
});
$("#bgPopupboxr").css({
"height": windowHeight
});
}
$(document).ready(function(){
$(".msgAction").click(function(){
//center
centerPopupboxr();
//load popupBox
loadPopupboxr();
});
$("#popupboxrContactClose").click(function(){
disablePopupboxr();
});
$("#bgPopupboxr").click(function(){
disablePopupboxr();
});
});
答案 0 :(得分:0)
从我看到的html循环中没有html代码,移动echo '
之前的结束括号并将其放在HTML之后。
-
我通过重新格式化您的代码找到了这个并找到了:
$gender=$row["gender"];}
这是一个隐藏的支撑,因为格式不佳而发生。