-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·92 lines (84 loc) · 2.24 KB
/
index.html
File metadata and controls
executable file
·92 lines (84 loc) · 2.24 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
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
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MY HTTPS</title>
<link rel="icon" href="Images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="Images/favicon.ico" type="image/x-icon" />
</head>
<html>
<body background='bg4.jpg'>
<center><h1>Chatroom</h1></center>
<style type="text/css">
.cdiv{
background-color: white;
background-image: url(bg4.jpg);
margin:auto;
height: 370px;
width: 600px;
padding-left: 0;
overflow-y: scroll;
position: relative;
word-wrap: break-word;
overflow-x: auto;
}
</style>
<script>
var t1='';
var t2='';
var myname='none';
function onkey(e)
{ var c ;
if(window.event) // IE
{
c= e.keyCode;
}
else if(e.which) // Netscape/Firefox/Opera
{
c = e.which;
}
if(c==13)
{
document.getElementById("send").click();
}
}
function get(str)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
t2=xmlhttp.responseText;
if(str!='undefined'||t1!=t2)
{var div = document.getElementById("divmsg");
div.scrollTop = div.scrollHeight;}
t1=xmlhttp.responseText;
}
}
xmlhttp.open("GET","his.txt?q="+str+"&n="+myname,true);
xmlhttp.send();
}
function loadFromInput(){
x=document.getElementById('message').value;
document.getElementById("message").value='';
return x;
}
myname= prompt("Please Input Your Name:","");
window.setInterval("get('undefined')",1000);
</script>
<div id="divmsg" class="cdiv">
<center><p><span id="txtHint"></span></p></center>
</div>
<center><p id="di">Please Input Message:</p></center>
<center><input type="text" onkeypress="onkey(event)" id = 'message' name="firstname" charset=UTF-8" />
<button onclick="get(loadFromInput())" id="send">Enter</button></center>
<body>
</html>