-
Notifications
You must be signed in to change notification settings - Fork 0
/
trythis.php
58 lines (51 loc) · 1.4 KB
/
trythis.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html >
<head>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script>
(function ($) {
jQuery.expr[':'].Contains = function(a,i,m){
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
};
function listFilter(header, list) {
var form = $("<form>").attr({"class":"filterform","action":"#"}),
input = $("<input>").attr({"class":"filterinput","type":"text"});
$(form).append(input).appendTo(header);
$(input)
.change( function () {
var filter = $(this).val();
if(filter) {
$(list).find("a:not(:Contains(" + filter + "))").parent().slideUp();
$(list).find("a:Contains(" + filter + ")").parent().slideDown();
} else {
$(list).find("li").slideDown();
}
return false;
})
.keyup( function () {
$(this).change();
});
}
$(function () {
listFilter($("#header"), $("#list"));
});
}(jQuery));
</script>
</head>
<body>
<div id="wrap">
<h1 id="header"></h1>
<ul id="list">
<?php
include_once "dbconnection.php";
$item = mysql_query("SELECT * FROM item");
while($fetch = mysql_fetch_assoc($item))
{
echo "<li><a href=''>".$fetch['item_desc']."</a></li>";
}
?>
</ul>
</div>
</body>
<script src="trythis.js"></script>
</html>