aboutsummaryrefslogtreecommitdiff
path: root/web/javascript/searchtip.js
blob: 5665bc1d96695481cef483d3e8f50139d3a7534c (plain)
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
59
60
61
62
63
64
// search tips for 'Get Any' and 'Combined' in the main search page http://www.genenetwork.org/
function searchtip(){

	var tfor     = document.getElementById("tfor");
	var tfand    = document.getElementById("tfand");
	var btsearch = document.getElementById("btsearch");
	var tiptextor  = "Enter list here (APOE, APOA, etc.): logical OR";
	var tiptextand = "Enter terms to combine (blood pressure): logical AND";

	if(tfor.value == "" || tfor.value == tiptextor) {
		tfor.className = "searchtip";
		tfor.value = tiptextor;
	}
	
	tfor.onfocus = function(e) {
		if(tfor.value == tiptextor) {
			tfor.value = "";
		}
		tfor.className = "";
	}
	tfor.onblur = function(e) {
		if(tfor.value == "") {
			tfor.className = "searchtip";
			tfor.value = tiptextor;
		} else if(tfor.value == tiptextor){
			tfor.className = "searchtip";
		} else {
			tfor.className = "";
		}
	}

	if(tfand.value == "" || tfand.value == tiptextand) {
		tfand.className = "searchtip";
        tfand.value = tiptextand;
	}
    
	tfand.onfocus = function(e) {
		if(tfand.value == tiptextand) {
			tfand.value = "";
        }
		tfand.className = "";
    }
	tfand.onblur = function(e) {
		if(tfand.value == "") {
			tfand.className = "searchtip";
			tfand.value = tiptextand;
		} else if(tfand.value == tiptextand) {
			tfand.className = "searchtip";		
		} else {
			tfand.className = "";
		}
    }
	
	btsearch.onclick = function(e) {
		if(tfor.value == tiptextor) {
			tfor.value = "";
		}
		if(tfand.value == tiptextand) {
			tfand.value = "";
        }
		return true;
	}
	
}