-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomment_page.js
More file actions
63 lines (41 loc) · 1.15 KB
/
comment_page.js
File metadata and controls
63 lines (41 loc) · 1.15 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<script>
function submitcomment() {
var request;
try {
request= new XMLHttpRequest();
}
catch (tryMicrosoft) {
try {
request= new ActiveXObject("Msxml2.XMLHTTP");
}
catch (otherMicrosoft)
{
try {
request= new ActiveXObject("Microsoft.XMLHTTP");
}
catch (failed) {
request= null;
}
}
}
var webpage= location.href;
position= webpage.lastIndexOf("/");
var lastpart= webpage.substring(position + 1);
var period= lastpart.indexOf(".");
var complete= lastpart.substring(0, period);
complete= complete.replace(/-/g, "_");
var url= "usercomments.php";
var username= document.getElementById("name_entered").value;
var usercomment= document.getElementById("comment_entered").value;
var vars= "name="+username+"&comment="+usercomment+"&webpage="+complete;
request.open("POST", url, true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.onreadystatechange= function() {
if (request.readyState == 4 && request.status == 200) {
var return_data= request.responseText;
document.getElementById("showcomments").innerHTML= return_data;
}
}
request.send(vars);
}
</script>