Thursday, October 30, 2008

Windows Live Toolbar broke my Shift+Tab

Finally!!!!!! For months my shift+tab in forms didn't work. IE or Firefox. Drove me crazy!!!!! Google a little this morning and found an entry that said uninstall Windows Live Toolbar. Thought "what the heck". It worked!!! Not only did fix IE but it also fixed FF. Don't understand. Don't care. Problem solved.

Monday, October 27, 2008

Adding commas to numbers with JavaScript

I recently went to add commas to a number on entry. Found a nice script here. Only thing I changed was to make it set the value in the function. I also liked his solution for adding separators other than commas.

The code:

function addCommas(obj) {
    nStr = obj.value;
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
    obj.value = x1 + x2;
}