-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
36 lines (36 loc) · 1.99 KB
/
index.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
<!DOCTYPE html>
<html>
<head><title>Damn Ugly Chat!</title><head>
<body>
<h1 style="text-align:center"><u style="background: #d19200; /* Old browsers */ background: -moz-linear-gradient(top, #d19200 0%, #00ff48 20%, #d800a2 41%, #00d4ff 57%, #808c00 86%, #db00c1 100%); /* FF3.6-15 */ background: -webkit-linear-gradient(top, #d19200 0%,#00ff48 20%,#d800a2 41%,#00d4ff 57%,#808c00 86%,#db00c1 100%); /* Chrome10-25,Safari5.1-6 */ background: linear-gradient(to bottom, #d19200 0%,#00ff48 20%,#d800a2 41%,#00d4ff 57%,#808c00 86%,#db00c1 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d19200', endColorstr='#db00c1',GradientType=0 ); /* IE6-9 */">Damn Ugly Chat!</u></h1>
Type Here:<input type="textbox" onkeydown="if(event.keyCode == 13)document.getElementById('send').click()">
<button id="send">Send</button>
(Type in the message and press "enter" key, that will work too.)
<br><br>
Messages:
<br>
<div id="messages" style="height:400px;width:100%;overflow:auto;border: 2px solid black;"></div>
<script>
function gimmeTime(){
var now = new Date();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
var ap = "AM";
if (hour > 11) { ap = "PM"; }
if (hour > 12) { hour = hour - 12; }
if (hour == 0) { hour = 12; }
if (hour < 10) { hour = "0" + hour; }
if (minute < 10) { minute = "0" + minute; }
if (second < 10) { second = "0" + second; }
var timeString = hour + ':' + minute + ':' + second + " " + ap;
return timeString;
}
document.querySelector("#send").onclick = function(){
document.querySelector("#messages").innerHTML += gimmeTime() + " : " + "<b>" + document.querySelector("input").value + "</b>" + "</br>";
document.querySelector("input").value = "";
document.querySelector("#messages").scrollTop = document.querySelector("#messages").scrollHeight;
}
</script>
<body>
</html>