Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require("dbconn.php"); ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>게시판프로그램</title>
- <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/start/jquery-ui.css">
- <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
- <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
- <style>
- #view { display: none; }
- </style>
- </head>
- <body>
- <table id="list" class="table table-hover">
- <tr>
- <td>번호</td>
- <td>제목</td>
- <td>글쓴이</td>
- <td>날짜</td>
- </tr>
- <?php foreach($db->query('SELECT * FROM board') as $row) { ?>
- <tr class="list-row" data-content="<?php echo $row['content'];?>">
- <td class="list-idx"><?php echo $row['idx'];?></td>
- <td class="list-title"><?php echo $row['title'];?></td>
- <td class="list-writer"><?php echo $row['writer'];?></td>
- <td class="list-wdate"><?php echo $row['wdate'];?></td>
- </tr>
- <?php } ?>
- </table>
- <div id="view">
- <table class="table">
- <tr><td>제목</td><td id="view-title"></td></tr>
- <tr><td>본문</td><td id="view-content"></td></tr>
- <tr><td>글쓴이</td><td id="view-writer"></td></tr>
- <tr><td>날짜</td><td id="view-wdate"></td></tr>
- </table>
- </div>
- <script>
- $(".list-row").click( function(){
- var idx = $(this).children(".list-idx").html();
- var title = $(this).children(".list-title").html();
- var writer = $(this).children(".list-writer").html();
- var wdate = $(this).children(".list-wdate").html();
- var content = $(this).attr("data-content");
- $("#view-title").html(title);
- $("#view-writer").html(writer);
- $("#view-wdate").html(wdate);
- $("#view-content").html(content);
- $("#view").dialog({
- title: title,
- width: 300,
- height: 300
- });
- } );
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment