43 lines
1,011 B
HTML
43 lines
1,011 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="css/style.css">
|
|
<script src="js/sci-script-tag.js" type="application/javascript"></script>
|
|
<script type="application/x-sci">
|
|
(defn my-alert []
|
|
(js/alert "You clicked!"))
|
|
|
|
(set! (.-my_alert js/window) my-alert)
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1>SCI script tag</h1>
|
|
|
|
<pre>
|
|
<code class="html">
|
|
<head>
|
|
<script src="https://borkdude.github.io/sci-script-tag/js/sci-script-tag.js" type="application/javascript"></script>
|
|
|
|
<script type="application/x-sci">
|
|
(defn my-alert []
|
|
(js/alert "You clicked!"))
|
|
|
|
;; export function to use from JavaScript:
|
|
(set! (.-my_alert js/window) my-alert)
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<button onclick="my_alert()">
|
|
Click me!
|
|
</button>
|
|
</body></code></pre>
|
|
|
|
<button onclick="my_alert()">
|
|
Click me!
|
|
</button>
|
|
|
|
</body>
|
|
</html>
|