forked from tntp/Tntp.CodingExercise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
45 lines (42 loc) · 1.46 KB
/
index.html
File metadata and controls
45 lines (42 loc) · 1.46 KB
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
<!DOCTYPE html>
<head>
<script src="script.js"></script>
<meta charset="UTF-8">
<title>Simple Twitter</title>
<script>
function testResults () {
var name = document.getElementById("name").value;
var comm = document.getElementById("comment").value;
var url = "./sendFormData?name=" + name + "&comment=" + comm;
loadURL(url, function(data) {
console.log("data sent");
});
}
function checkLength() {
var fieldLength = document.getElementById("comment").value.length;
//We need to limit comment to 140 characters
if(fieldLength<=140){
return true;
}
return false;
}
</script>
</head>
<body>
<div id="details">
<h1>Simple Twitter</h1>
<form name=main_form id="main_form" method = "get" enctype="multipart/form-data">
<fieldset>
<label for="name">Enter user-name:</label>
<input type="text" id="name" name="name" placeholder="alomalopes" required/>
<br/>
<br/>
<label for="comment">Enter your comment:</label>
<input type="text" id="comment" name="comment" placeholder="It is such a nice day today!" onkeypress="checkLength()"/>
<br/>
<input INPUT TYPE="button" NAME="button" Value="Click" onClick="testResults()"/>
</fieldset>
</form>
</div>
</body>
</html>