But this browser-jumpiing/-savvy demographic is hardly representative of the majority though, is it?
That majority may be luddites, but they're the luddites that your web sites have to appeal to (unless you build intranets/extranets, or demographically controlled/restricted sites).
(What happens when Chrome becomes like FireFox?)
Yay, time for me to use my favourite picture!
And to be really boring and on topic - attached is an anonymised version of what I was trying to do, although it would then be extended/copy+pasted for multiple countries.
I like how it looks, but I'm sure that the coding is terribly inefficient and when actually extended for lots of countries would probably become unmanageable.
//Check which checkboxes/options are selected var f5 = (document.listofoptions.elements['Check5'].checked); //Check if 'f5' is "true" and set to price, else set to zero if(f5 == true) { var f5 = 50; var w5 = 30; } else { var f5 = 0; var w5 = 0; }Could be replaced with a loop like this:
// Checkbox values must be in the format: "normal,wholesale" var checkBoxes = document.querySelectorAll("input[type=checkbox]"), max = checkBoxes.length, values, i, total = 0, totalWholesale = 0; for (i = 0; i < max; i += 1) { if (checkBoxes[i].checked) { values = checkBoxes[i].value.split(","); // The + on the end is to convert the value to a number. total += +values[0]; totalWholesale += +values[1]; } }
var getCheckboxes = function () { var i, elements = document.getElementsByTagName("input"), max = elements.length, result = []; for (i = 0; i < max; i += 1) { if (elements[i].type === "checkbox") { result.push(elements[i]); } } return result; };