Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>news list</title>
- <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/sunny/jquery-ui.css">
- <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
- <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
- </head>
- <body>
- <div id="newslist">
- <?php
- $conn = @mysql_connect("localhost","root","");
- @mysql_select_db("web",$conn);
- @mysql_query("set names utf8");
- $sql = "select no, title from news";
- $rs = @mysql_query($sql);
- while( $row = @mysql_fetch_array($rs) ) {
- ?>
- <a href="<?php echo $row['no'];?>"><?php echo $row['title'];?></a><br>
- <?php
- }
- ?>
- </div>
- <script>
- $("#newslist a").click(
- function(event){
- event.preventDefault();
- var link = $(this).attr("href");
- alert(link);
- }
- );
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment