class: middle ## a quick demo how to make bookmarklets `bookmarklets` like the the one I made for Exercise C are a quick way to package javascript for use on other pages. They work by placing your javascript code in the href of a link tag with the special `javascript:` preface. This is like `mailto:` or `tel:` prefaces for links. They signal to the browser to do something special with the link. The `javascript:` preface tells the browser to execute the text of the link as javascript. --- class: middle Then, we wrap our javascript within the link ```js document.body.style.transition = 'color 3s ease-in-out'; document.body.style.color = 'green'; ``` To wrap our javascript, put it all on one line within an anonymous function in parentheses and add the `()` at the end. ```js (function (){ document.body.style.transition = 'color 3s ease-in-out'; document.body.style.color = 'green'; })() ``` Normally this would execute the function right away. But since it's being placed in a link after the `javascript:` directive, it'll execute on click: ```html
Spring has sprung
```
Spring has sprung