1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>Tester</title> |
---|
5 | <style type="text/css"> |
---|
6 | font { cursor:pointer; font-weight:bold; color:blue; } |
---|
7 | div { background:yellow; width:300px; margin:5px; } |
---|
8 | </style> |
---|
9 | <script type="text/javascript" src="../jquery.js"></script> |
---|
10 | <script language='javascript'> |
---|
11 | $(document).ready(function(){ |
---|
12 | $('div.ajax').hide(); |
---|
13 | $('font.ajax').click(function() { |
---|
14 | var nextDiv = $(this).next('div.ajax'); |
---|
15 | var visibleSiblings = nextDiv.siblings('div:visible'); |
---|
16 | var href = $(this).attr('href'); |
---|
17 | if (visibleSiblings.length) { |
---|
18 | visibleSiblings.slideUp('500'); |
---|
19 | } |
---|
20 | $.get('data.php', { family: href },function(data) { |
---|
21 | $(nextDiv).slideToggle('500').html(data); |
---|
22 | }); |
---|
23 | }); |
---|
24 | }) |
---|
25 | </script> |
---|
26 | </head> |
---|
27 | <body> |
---|
28 | <font class="ajax" href="href.uri">Click here (odd use of font html tag)</font> |
---|
29 | <div class="ajax"> |
---|
30 | Target |
---|
31 | </div> |
---|
32 | <div> |
---|
33 | This one is visible |
---|
34 | </div> |
---|
35 | <div> |
---|
36 | So is this one |
---|
37 | </div> |
---|
38 | </body> |
---|
39 | </html> |
---|