主頁面:
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="../fzl/jquery-1.11.2.min.js"></script> //JQuery <script src="../tanchuang/tanchuang.js"></script> //彈窗 js <title>無標題文檔</title> <link href="../tanchuang/tanchuang.css" rel="stylesheet" type="text/css" /> //彈窗 css </head> <body> <input type="button" id="ck" value="顯示" /> <table width="80%" border="1"> <tr> <td>代號</td> <td>民族</td> <td>操作</td> <td>查看</td> </tr> <tbody id="tb"></tbody> </table> </body> <script type="text/javascript"> $(document).ready(function(e) { //點擊顯示 $("#ck").click(function(){ $.ajax({ url:"ajax8cl.php", dataType:"TEXT", success: function(data){ var hang = data.split("|"); var str = ""; for(var i=0;i<hang.length;i++) { var lie = hang[i].split("^"); str = str+"<tr><td>"+lie[0]+"</td><td>"+lie[1]+"</td><td><span class ='sc' bs ='"+lie[0]+"'>刪除</span></td><td><span class ='ck' bs='"+lie[0]+"'>查看詳情</span></td></tr>"; } $("#tb").html(str); //刪除 $(".sc").click(function(){ alert("aa"); }) //彈窗 $(".ck").click(function(){ var code =$(this).attr("bs"); $.ajax({ url:"ajax8ckcl.php", data:{code:code}, type:"POST", dataType:"TEXT", success: function(data){ var lie1 = data.split("^"); var str = "<div>代號:"+lie1[0]+"</div><div>"+lie1[1]+"</div>"; //核心內容 var btn1 = "<input type='button' value='確定' class='qd' />"; var tc = new Window({ title:"詳細信息", content:str, buttons:btn1 }); $(".qd").click(function(){ $(".zhuti").remove(); //點擊確定按鈕,彈窗移除 $("#zz").remove(); //點擊確定按鈕,遮罩移除 }) } }); }) } }); }) }); </script>
點擊顯示處理頁面:
<?php include("../fzl/czy.class.php"); $db = new czy(); $sql = "select * from nation"; echo $db->strQuery($sql);
彈窗處理頁面:
<?php include("../fzl/czy.class.php"); $db = new czy(); $code = $_POST["code"]; $sql = "select * from nation where code = '{$code}'"; echo $db->strQuery($sql);