Monday, August 21, 2006

CSS Properties To JavaScript Reference Conversion


I recently came across a site which compares CSS properties to javascript reference. It tables up all the different css properties and its conversion in javascript reference. It is a good to have link for a quick reference while programming.

Tags: , ,


Mouse wheel programming in JavaScript


Web applications are becoming more and more like “normal” desktop applications. Of course, they are more and more functional, but smooth user interface acts the primary role. So we have drag and drop, auto completion, and much more. Many of those nice features got possible only with help of AJAX.
          This page, however, is not about AJAX (or any other buzzword). It is about rather simple user input method -- mouse wheel. I believe it would now be difficult to find a mouse without wheel. Vast majority of users are used to the wheel as a control for scrolling in lists, zooming etc. Rather few web applications, however, make smart use of mouse wheel. This page is to provide you with general information about handling mouse wheel-generated events in JavaScript programming language.
         This page has annotated javascript code, which should explain the magic behind mouse wheel generated events.

Tags: , ,


Javascript error logging with AJAX


You spent days and nights making your javascript perfect but still users complains about errors. There is a way of making the debugging process a little less painful by logging javascript errors. Every javascript error can be trapped in the window.onerror event. We can return true or false so we can choose if the user shall see the normal javascript error dialog. This script will, in the very unlikely event of a javascript error, gather information about the error and send a httprequest to a page which will log the javascript error to the database.

function doError(msg,url,ln) {
    var strValues = "errMsg=" + escape(msg);
    strValues += "&errLine=" + ln;
    strValues += "&queryString=" + escape(location.search);
    strValues += "&Url=" + escape(location.pathname);
    strValues += "&HTTPRef=" + escape(document.referrer);

    if (typeof XMLHttpRequest != "object") {
        function XMLHttpRequest() {
            return new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    var objSave = new XMLHttpRequest();
    objSave.open("GET", "/errorSave/?" + strValues, false);
    objSave.send("");
}

try {
    window.onerror = doError;
}
catch(er) {}

More information at this post

Tags: ,