Archive | JavaScript RSS feed for this section

Targeting multiple browsers with CSS… and some Javascript trickery.

There’s a clever little javascript library that allows you to write CSS specifically for Chrome, the iPhone, IE 8, etc. all in a single file.  What it does is manipulate the HTML document client-side to add additional classes to the page, based on your browser type.  The end result is that your page gets additional selectors like .ie or .gecko added – and you can setup a single CSS file to target all of these browsers in one shot – no server side magic or conditional comments in the HTML.

You can find more information here ( http://snipplr.com/view/9340/css-browser-selector/ ) or download it from here (http://github.com/rafaelp/css_browser_selector ).

Tutorial Link: jQuery for Absolute Beginners

http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-video-series/

These look great (apart from the fact that he uses Visual Studio 2008 as his editing environment!). If you prefer video’s to books (or just like a combination) then you would do well to work through these.

Advanced Debugging with JavaScript

JavaScript debugging is a real pain.  Not only do you have the not-infrequent browser discrepancies, but the normal debugging tools aren’t fantastic.  With some advanced debugging tools though, you might just figure out which ‘Object is null or does not exist’.

http://www.alistapart.com/articles/advanceddebuggingwithjavascript

Dynamically loading JS libraries and detecting when they’re loaded

This is really useful - http://www.ejeliot.com/blog/109 I’ve used it for some of my revised swfobject scripts – loading the latest version of swfobject from the Google AJAX libraries in the event that someone forgets to include the local version of the swfobject files.

Executing multiple XMLHTTPRequests – successfully.

So I’m hacking together a simple client-side AJAX – based on AHAH - and all of the example scripts only work with a single request.  Attempting to use the same script twice meant that the results would overwrite each other.  Ughh.

The problem it turned out, was as a simple as the latter requests replacing the newer request, because their references were being overwritten.  So instead of using a single variable, I figured “why not pass the references around in the functions”.  Here it is then, an AHAH-based set of AJAX functions, that works for multiple simultaneous function calls.

Source code doesn’t really work very well in my blog template, so I’ve put the functions in an external javascript file…

Click here to download the javascript file.