-
Notifications
You must be signed in to change notification settings - Fork 0
/
SurveyForm_Sriman.html
497 lines (471 loc) · 16 KB
/
SurveyForm_Sriman.html
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Survey Page</title>
<style type = "text/css">
strong { font-weight: bolder;
color: black }
p { font-family:'Times New Roman', Times, serif;
font-size: 12pt;
color:black}
em { font-family: arial,helvetica, sans-serif;
font-weight: bolder;
color: black}
hr {
height: 5px;
color: Green;
background-color: Green;
border: none;
}
.main{
border: 1px solid black;
border-collapse: collapse;
}
h1 {
color: blue;
}
.shadow{
text-shadow: 0 0 3px #FF0000, 0 0 5px #0000FF;
}
</style>
</head>
<body bgcolor="White">
<table align="center" cellpadding="0" cellspacing="0" width="1000">
<tr> <td>
<a href ="http://cs.gmu.edu"> <img src="http://brand.gmu.edu/wp-content/uploads/assets/primarylogo/Mac/GMU_PLogo_RGB.jpg" alt="MasonLogo" width="200" height="100" / > </a> </td>
<td align="center"><p style ="font-size: 50px "; "width:500px" ;>George Mason University</p></td>
</table>
<hr/>
<div align="center">
<h1 class ="shadow"> Feedback Survey</h1>
<div>
<h3><strong><div align="center" id="cookie1"></div> </h3></strong>
<h3> <div align="center" id="cookie2"></div> </h3>
</div>
<table class="main" align="center" cellpadding="10" cellspacing="0">
<form action="SurveyPage.html" onclick="#" name="surveyform" method="get" autocomplete="on">
<tr>
<td>
<label>*<strong> User Name : </strong></label>
<input id="name" type="text" maxlength="20" name="firstname" placeholder="FirstName LastName" required= "required" autofocus="true" />
</td>
</tr>
<tr>
<td>
<label>*<strong> Address :</strong> </label>
<input id="Address" type="text" maxlength="60" name="Address" required= "required"/>
</td>
</tr>
<td>
<label>* <strong> City :</strong></label>
<label id="city1" type="text" maxlength="40" placeholder = "Enter City" name="City" />
</td>
</tr>
<tr>
<td>
<label>* <strong> State :</strong></label>
<label id="state1" type="text" maxlength="40" placeholder = "Enter State" name="State" />
</td>
</tr>
<tr>
<td>
<label>* <strong> Zip : </strong> </label>
<input id="zip1" type="text" maxlength="5" name="zip" placeholder="12345" required= "required" onblur = "ZipData()"/>
<span id="zipError"></span>
</td>
</tr>
<tr>
<td>
<label>* <strong> Phone : </strong> </label>
<input id="Phone" type="tel" maxlength="12" name="Phone" pattern="\d{3}-\d{3}-\d{4}" placeholder="xxx-xxx-xxxx" required= "required"/>
</td>
</tr>
<tr>
<td>
<label>* <strong> Email : </strong></label>
<input id="Mail" type="email" maxlength="40" name="Mail" placeholder="[email protected]" required= "required"/>
</td>
</tr>
<tr>
<td>
<label>* <strong> URL : </strong></label>
<input id="url" type="url" maxlength="40" name="url" placeholder="http://www.abc.com" required= "required"/>
</td>
</tr>
<tr>
<td>
<label>* <strong> Date of Survey: </strong></label>
<input id="Date" type="date" maxlength="10" name="Date" placeholder="MM/DD/YYYY" required= "required"/>
</td>
</tr>
<tr>
<td>
<label>* <strong>What you like the most about the campus? </strong></label>
<br>
<table>
<tr>
<td>
<input type="checkbox" name="campus" value="student" />
<label>Students</label>
</td>
<td>
<input type="checkbox" name="campus" value="location" />
<label>Location</label>
</td>
<td>
<input type="checkbox" name="campus" value="campus" />
<label>Campus</label>
</td>
<td>
<input type="checkbox" name="campus" value="atmosphere" />
<label>Atmosphere</label>
</td>
<td>
<input type="checkbox" name="campus" value="dorrooms" />
<label>Dorm Rooms</label>
</td>
<td>
<input type="checkbox" name="campus" value="sports" />
<label>Sports</label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<label>* <strong> What made you know about the university? </strong> </label>
<br>
<table align="left">
<tr>
<td>
<input type="radio" name="university" value="friends" />
<label>Friends</label>
</td>
<td>
<input type="radio" name="university" value="television" />
<label>Television</label>
</td>
<td>
<input type="radio" name="university" value="internet" />
<label>Internet</label>
</td>
<td>
<input type="radio" name="university" value="other" />
<label>Other</label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<label>* <strong> Graduated on: Month</strong> </label>
<input list="datalist" placeholder="Select" required="required" />
<datalist id="datalist">
<option value="January">
<option value="February">
<option value="March">
<option value="April">
<option value="May">
<option value="June">
<option value="July">
<option value="August">
<option value="September">
<option value="October">
<option value="November">
<option value="December">
</datalist>
<label>* <strong> Year : </strong> </label>
<input type="text" width="4" maxlength="4" placeholder="yyyy" required="required" />
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<label>* <strong> Data </strong> </label>
<br>
<textarea id="num" required="required" placeholder="Enter 10 comma separated numbers" rows="3" cols ="30" onblur="getData()"></textarea>
</td>
<br>
<tr>
<td>
<label> <strong> Maximum : </strong> </label>
<input type = "text" id="maximum" ></label>
</td></tr>
<tr>
<td>
<label> <strong> Average : </strong> </label>
<input type = "text" id="average" ></label>
</td>
</tr>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<label>* <strong> I would like to recommend to others </strong> <i></label>
<select>
<option value="VLikely">Very Likely</option>
<option value="Likely">Likely</option>
<option value="ULikely">Unlikely</option>
</select>
</td>
</tr>
<tr>
<td >
<label> <strong> Comments: </strong></label>
<br>
<textarea rows="3" cols="30"></textarea>
<input type="submit" name="Submit" value="Submit" align="middle" id="Submit"/>
</td>
</tr>
<td align="center">
<input type="submit" name="Submit" value="Submit" align="middle" id="Submit" onclick="return Validation()"/>
<input type="reset" name="Reset" value="Reset" align="middle" id="Reset"/>
</td>
</form>
</table>
<table align="center" width="1000" cellpadding="0" cellspacing="0">
<hr>
<td style="font-size:30px" align="center"> <strong> Sriman Yadagiri </strong> </td>
<td style="font-size:30px" align="center"> <strong> G01025909 </strong> </td>
<td align="right" ><a href="http://www.gmu.edu/"/> <img src="http://brand.gmu.edu/wp-content/uploads/assets/primarylogo/Mac/GMU_PLogo_RGB.jpg" width="210" height="140" /> </a> </td>
</table>
</body>
<script type = "text/javascript">
var now = new Date();
var hour = now.getHours();
var name;
var time;
if ( hour < 12 )
time = "<h4>Good Morning ";
else
{
hour = hour - 12;
if ( hour < 4)
time = "<h4>Good Afternoon ";
else
time = "<h4>Good Evening ";
}
if ( document.cookie )
{
var myCookie = unescape( document.cookie );
var cookieTokens = myCookie.split( "=" );
name = cookieTokens[ 1 ];
}
else
{
name = window.prompt( "Please Enter Your Name", "" );
document.cookie = "name=" + escape( name );
}
var str1= time + name + ", Please Give Us Your Feedback!!</h4>" ;
var x = document.getElementById("cookie1");
x.innerHTML = str1;
var str2 = "<div align=center><a href = 'javascript:wrongPerson()' align=center> " +
"Click Here If You Are Not " + name + "</a> </div><br />" ;
var y = document.getElementById("cookie2");
y.innerHTML = str2;
function wrongPerson()
{
document.cookie= "name=Unknown;" +
" expires=Fri, 12-Mar-2016 00:00:01 GMT";
location.reload();
}
function ZipData()
{
var xmlhttp;
var Url= "ZipCode.json";
var zip2= document.getElementById("zip1").value;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var data = xmlhttp.responseText;
var zc= JSON.parse(data);
var i,flag=0;
for(i=0; i<zc.zipcodes.length; i++)
{
if(zc.zipcodes[i].zip==zip2)
{
flag=1;
break;
}
}
if(flag==1)
{
document.getElementById( "city1" ).innerHTML =zc.zipcodes[i].city;
document.getElementById( "state1" ).innerHTML =zc.zipcodes[i].state;
}
else
{
alert("Invalid Zip");
document.getElementById("zip1").innerHTML="";
document.getElementById("zip1").focus();
document.getElementById("zipError").innerHTML = "Invalid zip, please choose a zipcode among 22030, 22312, 22301, 20148";
document.getElementById("city1").value = "";
document.getElementById("state1").value = "";
}
}
}
xmlhttp.open( "GET",ZipCode.json, true );
xmlhttp.setRequestHeader("Accept","application/json; charset=utf-8" );
xmlhttp.send();
}
function Validation()
{
var error = [];
var ElementFocus = [];
var name = document.getElementById("name").value;
if(name == "")
{
error.push("Please Enter Name");
document.getElementById("name").value = "";
ElementFocus.push("name");
}
else if(!name.match(/^[A-z]+$/))
{
error.push("Name should contain only Alphabets");
document.getElementById("name").value = "";
ElementFocus.push("name");
}
var address = document.getElementById("Address").value;
if(address == "")
{
error.push("Please enter address");
document.getElementById("Address").value = "";
ElementFocus.push("Address");
}
else if(!address.match(/^[A-z0-9]+$/))
{
error.push("Address box should contain alphanumeric characters");
document.getElementById("Address").value = "";
ElementFocus.push("Address");
}
var Zip = document.getElementById("zip1").value;
if(Zip == "")
{
error.push("Please Enter Zip");
document.getElementById("zip1").value = "";
ElementFocus.push("zip1");
}
else if(!Zip.match(/^[0-9]+$/))
{
error.push("Zip should contain only Numbers");
document.getElementById("zip1").value = "";
ElementFocus.push("zip1");
}
var email = document.getElementById("Mail").value
if (email == "")
{
error.push("please enter email");
document.getElementById("Mail").value = "";
ElementFocus.push("Mail");
}
else if(!email.match(/^[\_]*([a-z0-9]+(\.|\_*)?)+@([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$/))
{
error.push("email entered is not valid");
document.getElementById("Mail").value = "";
ElementFocus.push("Mail");
}
var url = document.getElementById("url").value
if (url == "")
{
error.push("please enter URL");
document.getElementById("url").value = "";
ElementFocus.push("url");
}
var date = document.getElementById("Date").value
if (date == "")
{
error.push("please enter date");
document.getElementById("Date").value = "";
ElementFocus.push("Date");
}
var elements = document.getElementsByTagName("input");
noOfCheckBoxes =0;
for(var i =0; i<elements.length;i++)
{
if(elements[i].type === "checkbox" && elements[i].checked === true)
{
noOfCheckBoxes++;
}
}
if(noOfCheckBoxes <2)
{
error.push("Check atleast two options for 'What you like the most about the campus?'");
ElementFocus.push("campus");
}
//var elements = document.getElementsByName("input");
noOfRadioButtons =0;
for(var i =0; i<elements.length;i++)
{
if(elements[i].type === "radio" && elements[i].checked === true)
{
noOfRadioButtons++;
}
}
if(noOfRadioButtons <1)
{
error.push("Please choose an option for 'What made you know about the university?'");
ElementFocus.push("university");
}
var errorMessage = "";
if (error.length > 0)
{
for (var i = 0; i < error.length; i++)
{
errorMessage = errorMessage + error[i] + "\n";
}
alert(errorMessage);
var focusElement = ElementFocus[0];
document.getElementById(focusElement).focus();
}
}
function getData()
{
var data= document.getElementById("num").value;
var num = data.split(',');
var average = document.getElementById("average");
var maximum = document.getElementById("maximum");
var count = 0;
var y = 0;
if(num.length >= 10)
{
for (var i = 0; i < num.length; i++)
{
if(parseInt(num[i]) < 1 || parseInt(num[i]) > 100)
{
alert( "Please Enter Numbers Between 1 - 100" );
document.num.focus() ;
return false;
}
count= count + parseInt(num[i]);
if (y < parseInt(num[i]) )
y = parseInt(num[i]);
}
count=count/i;
}
else
{
alert( "Please Enter 10 Numbers" );
document.survey.num.focus() ;
return false;
}
average.value = count;
maximum.value = y;
}
</script>
</html>