Tag Archives: JavaScript

Fixing the Internet Explorer BUTTON form submission bug

Internet Explorer 6/7 incorrectly handle a form submission with the <button/> element. Consider <button name=”action” value=”next”>Go to step 3</button> <button name=”action” value=”back”>Back to step 1</button> What should happen is the value of the button used clicked by the user should be posted with the action parameter. IE however posts the inner HTML of the button. [...]

Posted in JavaScript | Also tagged , , , | Leave a comment

Parse URL paramters into a JavaScript object

This function takes a URL with parameters and returns a JavaScript object with key/value pairs. If this function is called without a parameter it will use the current documents URL. url = window.location function getParameters(url) { var q = url ? url.search.substr(1) : window.location.search.substr(1), res = {}, tokens = [];   tokens = q.split(’&’); for [...]

Posted in JavaScript | Also tagged | Leave a comment

Greasemonkey script for switching CSS

I wrote a simple script that allows me to remove a web page’s stylesheet imports and load in my own. In the following exmaple I am leaving the reset-min.css import intact, and loading the new CSS from my local web server. // ==UserScript== // @name styleSwitcher // @namespace https://www.deanoj.co.uk/ // @description Replaces all site CSS [...]

Posted in JavaScript | Also tagged | 2 Comments