summaryrefslogtreecommitdiffstats
path: root/notFinishedCode/web/ajax.php
blob: ed8f4b6dbbb969eaab9ddb1efe11abca715e15c3 (plain) (blame)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

<head> <title> Results page </title> <style> 
/* -------------------------------------------------------
Author: Vitaly Friedman
Theme: Green Life - A Fresh, Warm and Readable Table
URL: http://www.alvit.de/vf
-------------------------------------------------------
*/
 
 		table {
			font: 11px verdana,verdana, arial;
			margin: 0;
			padding: 0;
			border-collapse: collapse;
			text-align: left;
			color: #333;
			line-height: 19px;
		}
		
		caption {
			font-size: 14px;
			font-weight: bold;
			margin-bottom: 20px;
			text-align: left;
			text-transform: uppercase;
		}
		
		td {
			margin: 0;
			padding: 20px 10px;
			border: 1px dotted #f5f5f5;
		}
		
		
		th {
			font-weight: normal;
			text-transform: uppercase;
		}
		
		thead tr th {
			background-color: #575757;
			padding:  20px 10px;
			color: #fff;
			font-weight: bold;
			border-right: 2px solid #333;
			text-transform: uppercase;
			text-align:center;
		}
		
		tfoot tr th, tfoot tr td {
			background-color: transparent;
			padding:  20px 10px;
			color: #ccc;
			border-top: 1px solid #ccc;
		}
		
		tbody tr th {
			padding: 20px 10px;
			border-bottom: 1px dotted #fafafa;
		}
		
		tr { 
			background-color: #FBFDF6;
		}
		tr.odd {
			background-color: #EDF7DC;
		}
		
		tr:hover {
		}
		
		tr:hover td, tr:hover td a, tr:hover th a {
			color: #a10000;
		}
		
		td:hover {
		}
 
		tr:hover th a:hover {
			background-color: #F7FBEF;
			border-bottom: 2px solid #86C200;
		}
		
		table a {
			color: #608117;
			background-image: none;
			text-decoration: none;
			border-bottom: 1px dotted #8A8F95;
			padding: 2px;
			padding-right: 12px; background: transparent url(http://www.alvit.de/vf/csstablegallery/link.gif) no-repeat 100% 50%;
		}
 
		table a:hover {
			color: #BBC4CD;
			background-image: none;
			text-decoration: none;
			border-bottom: 3px solid #333;
			padding: 2px;
			padding-right: 12px; color: #A2A2A2; background: transparent url(http://www.alvit.de/vf/csstablegallery/link.gif) no-repeat 100% 50%;
		}
		
		table a:visited {
			text-decoration: none;
			border-bottom: 1px dotted #333;
			text-decoration: none;
			padding-right: 12px; color: #A2A2A2; background: transparent url(http://www.alvit.de/vf/csstablegallery/visitedLink.gif) no-repeat 100% 50%;
		}
		
		table a:visited:hover {
			background-image: none;
			text-decoration: none;
			border-bottom: 3px solid #333;
			padding: 2px;
			padding-right: 12px; color: #A2A2A2; background: transparent url(http://www.alvit.de/vf/csstablegallery/visitedLink.gif) no-repeat 100% 50%;
		}
</style> 
<html>
<head>
<title>Simple Ajax Example</title>
<script language="Javascript">
function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;

    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }

    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    updatepage('<img src="loader.gif" alt="Loading"/>');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 3) {
            updatepage(self.xmlHttpReq.responseText);
        }
           // updatepage(self.xmlHttpReq.responseText);
    }
    self.xmlHttpReq.send(getquerystring());
}

function getquerystring() {
    var form     = document.forms['f1'];
    var word = form.word.value;
    qstr = 'w=' + escape(word);  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(str){
    document.getElementById("result").innerHTML = str;
}
</script>
</head>
<body>
<form name="f1">
<p>
  word: <input name="word" type="hidden" value="ludnica?refa?tela">  
  <input value="Go" type="button" onclick='JavaScript:xmlhttpPost("/socket2.php")'></p>
  <div id="result"></div>
</form>
</body>
</html>