OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / custom_search_box / include / template / index.tmpl.html
1 <patTemplate:tmpl name="_widget">
2 <script type="text/javascript">
3 //<![CDATA[
4 function custom_search(){
5         $('#{SEARCH_TEXT_ID}').attr('disabled', 'disabled');
6         $('#{SEARCH_BUTTON_ID}').attr('disabled', 'disabled');
7         var value = $('#{SEARCH_TEXT_ID}').val();
8         if (value) document.custom_search_box.keyword.value = value;
9         document.custom_search_box.act.value = '{SEARCH_ACT}';
10         document.custom_search_box.submit();
11         return true;
12 }
13 function custom_search_reset(){
14         $('#{SEARCH_FORM_ID} :input').each(function(){
15                 var type = this.type;
16                 var tag = this.tagName.toLowerCase();
17                 if (type == 'text' || type == 'password' || tag == 'textarea'){
18                         this.value = '';
19                 } else if (type == 'checkbox' || type == 'radio'){
20                         this.checked = false;
21                 } else if (tag == 'select'){
22                         this.selectedIndex = -1;
23                 }
24         });
25 }
26 $(function(){
27         $('#{SEARCH_TEXT_ID}').val('{KEYWORD}');
28         $('#{SEARCH_BUTTON_ID}').click(function(){
29                 custom_search();
30         });
31         $('#{SEARCH_RESET_ID}').click(function(){
32                 custom_search_reset();
33         });
34 });
35 //]]>
36 </script>
37 <form id="{SEARCH_FORM_ID}" name="custom_search_box" method="get" class="form" onsubmit="custom_search();">
38 <input type="hidden" name="sub" value="{PAGE_SUB}" />
39 <input type="hidden" name="act" />
40 <input type="hidden" name="keyword" />
41 {HTML}
42 </form>
43 <patTemplate:tmpl name="message" visibility="hidden"><div class="search_message">{MESSAGE}</div></patTemplate:tmpl>
44 </patTemplate:tmpl>