【问题标题】:How to Show Popup window on clicking dynamically generated link如何在单击动态生成的链接时显示弹出窗口
【发布时间】:2014-02-15 10:03:42
【问题描述】:

有一个页面,在该页面上动态创建结果。和我 想要在单击名为 view.jpg 的图像时显示弹出窗口。这 图像是超链接。所以请告诉我我该怎么做。我正在展示 我的代码如下。

代码:

echo "<table width='' height='' border='1' align='center'>
        <tr><td>Title</td>
            <td >Type</td>
            <td >Date</td>
            <td>Expiry Date</td>";
            if($typeofuser=='admin' || $typeofuser=='Accountant' || $typeofuser=='secretary')
            {
            echo "<td>View</td>
            <td>Edit</td>
            <td>Delete</td>";
            }
        echo "</tr>";

            $qry2 = mysqli_query($con,"SELECT nId,nTitle,nDescription,nDate,nExpiryDate FROM tblnoticemanager where Society_id = '$socId' and category='General'") or die(mysqli_error($con));
                while($NoticeData = mysqli_fetch_array($qry2))
                {
                echo "<tr>"; 
                    echo  "<td align='center' class='tdletter' style='text-transform:capitalize;'>" .$NoticeData['nTitle']. "</td>";
                    echo  "<td align='center' class='tdletter' ><div class='overflowDiv'>" . $NoticeData['nDescription']."</div></td>"; 
                    echo  "<td align='center' class='tdletter'>" . $NoticeData['nDate'] ."</td>"; 
                    echo  "<td align='center' class='tdletter'>" . $NoticeData['nExpiryDate'] ."</td>";
                    if($typeofuser=='admin' || $typeofuser=='Accountant' || $typeofuser=='secretary')
                    {
                    echo  "<td align='center' class='tdletter'><div><a href='?id=".urlencode(base64_encode($NoticeData['nId']))."'><img src='images/view.png' width='30' height='30' align='center' /></a></div></td>";
                    echo  "<td align='center' class='tdletter'><div><a href='?id=".urlencode(base64_encode($NoticeData['nId']))."' ><img src='images/edit.jpg' width='30' height='30' align='center'/></a></div></td>";  
                    echo  "<td align='center' class='tdletter'><span id='".$NoticeData['nId']."' class='trash'><img src='images/delete1.jpg' width='30' height='30' align='center' /></span></td>";
                    }
                echo "</tr>";              
                 }          
echo "</table>";

【问题讨论】:

  • 实现简单的弹出框并传递动态id

标签: php jquery html mysqli


【解决方案1】:

您可以使用attribute selector [attribute='value']

$("[src='images/view.png']").click(function(){
     alert("clicked");
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-27
    • 1970-01-01
    • 2010-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-09
    相关资源
    最近更新 更多