Buttons JavaScript Code Snippets

These snippets all deal with JavaScript button effects. Every entry now also has a source code box so you may see the exact JavaScript code used to create the button.

Results via Envato Market

Allows the user to increase and decrease the value in a textbox by clicking up and down buttons. Useful if you would like to allow the user to quickly modify a value in your form. A short script too, just a few lines.

This script produces very application-looking buttons (with an underlined letter) which can be used via ALT key! Works in MSIE, and Netscape.

This is a JavaScript that shows you different window dimensions. It helps you to customize your web pages with the dimensions that best compliment your web site.

Use JavaScript to alert your user with the contents of a textarea box! This serves little purpose in the real world, but nonetheless is a great example of JavaScript. Type something in the box and hit Alert Me!

Refresh the current page. This button works just like your browser’s refresh button. Short and simple. Nice!

Are you feeling, I don’t know…. A little random? Then check out this random link generator! It randomly selects a URL from a pre-determined list and sends the user there!

By adding this code to your Web site, users can print out the current page by simply clicking a button.

Do you not like where window.open() opens your new windows? Using this JavaScript, you can actually have the new window open wherever you want! Look at our example to see what we mean! Really neat!

An Error Was Encountered The URI you submitted has disallowed characters.

Let JavaScript introduce you to the increasingly popular Mr. Push Me! Mr. Push doesn’t mind the occassional push, but watch out if you over do it!

Easily create active buttons with any image. Repositions image when your mouse passes over it and moves again when clicked on. Easy!