js.html 986 B

123456789101112131415161718192021222324252627282930313233343536
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>MuJS demo</title>
  6. <style>
  7. body { background-color: #101018; color: #e0e0e8; margin: 24px; }
  8. h1 { color: #7fb0ff; }
  9. #out { color: #80d090; }
  10. li { margin: 6px 0; }
  11. </style>
  12. </head>
  13. <body>
  14. <h1>MuJS demo</h1>
  15. <p id="out">The script has not run yet.</p>
  16. <ul>
  17. <li>External: <b id="ext">?</b></li>
  18. <li>2 + 3 = <b id="sum">?</b></li>
  19. <li>Math.sqrt(16) = <b id="sqrt">?</b></li>
  20. <li>Date: <span id="date">?</span></li>
  21. </ul>
  22. <script src="JSEXT.JS"></script>
  23. <script>
  24. if (typeof extLoaded === 'undefined')
  25. throw new Error('external script did not run first');
  26. document.getElementById('sum').textContent = String(2 + 3);
  27. document.getElementById('sqrt').textContent = String(Math.sqrt(16));
  28. document.getElementById('date').textContent =
  29. new Date().toISOString();
  30. document.getElementById('out').textContent =
  31. 'Inline JavaScript is running.';
  32. console.log('MuJS demo: ' + location.href);
  33. alert('MuJS demo ran');
  34. </script>
  35. </body>
  36. </html>