-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial and prolly the last commit ever
- Loading branch information
Tero Heino
committed
Nov 3, 2014
1 parent
d0b0f9c
commit f7c1860
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |