OSDN Git Service

first git
[mashup-kakaku/kakApple.git] / javascript / function_form.js
1 /*
2 -----------------------------------------------
3 Licensed under the GPL licenses.
4 Author:         Coronet Internet Service, Kyoji KATO.
5 Date:           2011-05-15
6 URL :           http://blog.coronet-internet.com
7 ----------------------------------------------- */
8 var inp_keyword = document.createElement('input');
9     inp_keyword.setAttribute('type', 'text');
10     inp_keyword.setAttribute('value', 'Search word here.');
11     inp_keyword.setAttribute('name', 'Keyword');
12         inp_keyword.style.color='#7f7f7f';
13         inp_keyword.setAttribute('onfocus','if (this.value == "Search word here."){this.value = "";this.style.color="#7f7f7f";}');
14         inp_keyword.setAttribute('onblur', 'if (this.value == ""){this.value = "Search word here.";this.style.color="#7f7f7f";}else{this.style.color="#ef027d";}');
15         document.getElementById('Keyword').appendChild(inp_keyword);
16         
17 function send() {
18         if (document.search.Keyword.value=="Search word here."){
19                 alert("You didn't input search word");
20                 return false;
21         }else{
22         var keyword=encodeURI(document.search.Keyword.value);
23         }
24         var category=document.search.Category.value;
25         if (document.search.Sort[0].checked){
26                 sort=document.search.Sort[0].value;
27         }else if(document.search.Sort[1].checked){
28                 sort=document.search.Sort[1].value;
29         }else if(document.search.Sort[2].checked){
30                 sort=document.search.Sort[2].value;
31         }else if(document.search.Sort[3].checked){
32                 sort=document.search.Sort[3].value;
33         }
34 var query="keyword="+keyword+"&sort="+sort+"&category="+category+"&pagenum=1";
35         location.href="result.html?"+query;
36 }