button.js

What is button.js?

button.js is a tiny and simple JavaScript framework I put together for my NeoCities website that makes the <button> tag easier to use. It isn't anything special, nor is it something most people can't make themselves; button.js exists as a convenience thing. I made it because I got sick of writing the same code in the head tags of all my pages, and figured others might find it useful.

How do you use button.js?

  1. Create a file called 'button.js' somewhere your HTML file can reach it.
  2. Copy and paste the below into it
  3. Add something like this to your <head> tag:
    <script src="button.js">
    <script src="../../button.js">
    <script src="../scripts/button.js">

Syntax

Source Code

                
                    function button(x) {
                        window.location = x;
                    }
                    
                    function anchor(x) {
                        window.location = '#'+x;
                    }
                    
                    function frame(x, y) {
                        document.getElementById(x).src = y;
                    }
                
            

Examples

button()

anchor()

frame()