Skip to content

Commit

Permalink
initial and prolly the last commit ever
Browse files Browse the repository at this point in the history
  • Loading branch information
Tero Heino committed Nov 3, 2014
1 parent d0b0f9c commit f7c1860
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
simple-message-displayer-js
===========================

sender.html & receiver.html, just a javascript locastorage thingie
sender.html & receiver.html, just a javascript locastorage thingie.


Open both files on same computer and send msg from one window/tab to another.
29 changes: 29 additions & 0 deletions receiver.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Receiver</title>
</head>
<body bgcolor="#FFFFFF">
<div id="msg" style="font-size: 2em; text-align: center;">..waiting for msg..</div>


<script type="text/javascript">
<!--
var msg = "";
function update_msg(){
if (msg != localStorage.getItem('msg')) {
msg = localStorage.getItem('msg');
document.getElementById("msg").innerHTML = msg;
}

setTimeout(update_msg, 1*1000);

}

update_msg();

//-->

</script>
</body>
</html>
28 changes: 28 additions & 0 deletions sender.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sender</title>
</head>
<body bgcolor="#FFFFFF">
<div align="center">

<input type="text" id="msg" onkeypress="return sendMsg(event)" />
<script type="text/javascript">
<!--
function sendMsg(e) {
if (!e) e = window.event;
var keyCode = e.keyCode || e.which;
if (keyCode == '13'){
localStorage.setItem('msg',document.getElementById("msg").value);
document.getElementById("msg").value = "";
return false;
}
}

//-->

</script>

</div>
</body>
</html>

0 comments on commit f7c1860

Please sign in to comment.