Playing with inline JavaScript

For something a bit lighter, today I decided I want to add some inline
JavaScript to today's blog entry. In case you don't know,
JavaScript is
a core programming language of the internet, and is widely used to make
websites interactive. There are lots of good tutorials available to learn
how to program with JavaScript. Two that I use are
W3Schools and
Mozilla's JavaScript tutorials.
While JavaScript is usually added in a separate file, it can also be added
directly to the HTML file in <script>
tags.
The most straightforward way to add JavaScipt is with a button. In this case,
the JavaScript can go right in the <button>
tag. For example:
However, I've heard that this is considered somewhat sloppy. More often,
the button will just call a function defined in <script>
tags
in the HTML head or body (in this case using the head). For a personalized greeting
enter your name in the box, and click the "Greet" button below.
Eventually, I would like to add more intractivity to my website. Some ideas that I have planned:
- Modern navigation with collapsible menu
- JavaScipt games
- D&D tools, perhaps a random encounter generator
- JavaScipt port of my little Word-Finder python script that can solve the NYT Spelling Bee game
- Maybe a simple unit-conversion utility
But it's getting late tonight, so I will add those features to my site later. If you have any ideas about some cool or useful JavaScipt feature for me to add, let me know!
← Back to the blog