index.html 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE html>
  2. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  5. <title>Serialize-javascript: ver 6.0.0c, no npm requirements</title>
  6. <link rel="shortcut icon" href="./favicon.ico" />
  7. <meta name="description" content="The complete serialization solution from Yahoo"/>
  8. <meta name="keywords" content="5 Mode,object"/>
  9. <meta name="robots" content="index,follow"/>
  10. <meta name="author" content="5 Mode"/>
  11. <script src="./serialize-javascript.js" type="text/javascript"></script>
  12. <link href="./css/style.css" type="text/css" rel="stylesheet">
  13. <script type="text/javascript">
  14. function myObj() {
  15. const s = "Hello World!";
  16. // Properties
  17. this.msg = s;
  18. this.start = mystart;
  19. // Methods
  20. function mystart() {
  21. alert(this.msg);
  22. }
  23. }
  24. function serializeDemo() {
  25. thiss = new myObj();
  26. alert(serialize(thiss));
  27. }
  28. function deserializeDemo() {
  29. thiss = new myObj();
  30. s = serialize(thiss);
  31. thatt = deserialize(s);
  32. thatt.start();
  33. }
  34. </script>
  35. </head>
  36. <body style="margin-top:20px;">
  37. <div style="text-align:center;">
  38. Given the following object:<br><br>
  39. <pre style="width:300px; margin:auto; background: lightgray; text-align:left">
  40. function myObj() {
  41. const s = "Hello World!";
  42. // Properties
  43. this.msg = s;
  44. this.start = mystart;
  45. // Methods
  46. function mystart() {
  47. alert(this.msg);
  48. }
  49. }
  50. </pre>
  51. <br>
  52. <input type="button" id="butSerializeDemo" value="Serialize demo" onclick="serializeDemo()">
  53. <br><br>
  54. <input type="button" id="butDeserializeDemo" value="Deserialize demo" onclick="deserializeDemo()">
  55. </div>
  56. </body>
  57. </html>