0
|
1 <?xml version="1.0" encoding="iso-8859-1"?>
|
|
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
|
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|
4 <html xmlns="http://www.w3.org/1999/xhtml">
|
|
5 <head>
|
|
6 <title>front door message</title>
|
|
7 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
|
|
8 </head>
|
|
9 <body>
|
|
10
|
|
11 Front door message:
|
|
12 <div><textarea name="message"></textarea></div>
|
|
13 <div><input type="text" name="lastLine"/></div>
|
|
14 <div id="save"></div>
|
|
15 <script type="text/javascript">
|
|
16 // <![CDATA[
|
|
17
|
|
18 $(function () {
|
|
19
|
|
20 function setup(elem, url) {
|
|
21 $.get(url, function (data) { elem.val(data) });
|
|
22
|
|
23 elem.keyup(function() {
|
|
24 $("#save").css("color", "yellow").text("saving...");
|
|
25 $.ajax({
|
|
26 type: "PUT",
|
|
27 url: url,
|
|
28 data: elem.val(),
|
|
29 success: function () {
|
|
30 $("#save").css("color", "black").text("ok");
|
|
31 }
|
|
32 });
|
|
33 });
|
|
34 }
|
|
35
|
|
36 setup($("textarea[name=message]"), "message");
|
|
37 setup($("input[name=lastLine]"), "lastLine");
|
|
38
|
|
39 });
|
|
40
|
|
41 // ]]>
|
|
42 </script>
|
|
43
|
|
44 </body>
|
|
45 </html> |