Archive | JavaScript RSS feed for this section

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.

Inline Javascript and the defer attribute

We use javascript to load our Flash elements into Webpages – it just makes life so much easier. There’s many ways you can go about it, but one is to use inline Javascript to handle function calls to your document.write(); or innerHTML(); functions. Naturally, these functions scrape through our HTML and do their business, targeting and replacing elements with the embed/object code for our Flash movies.

You might call us slackers, or you might base it on our faulty understanding of the defer attribute (and this site will confirm it), but we thought that adding the defer attribute to our inline code thus;

<script type="text/javascript" defer>
    addFlash('flashdiv');
</script>

Would mean that the inline script wouldn’t be executed until the whole page is loaded. So you could effectively add the code anywhere in the page – say, the header – and it didn’t matter. Well, what works in Internet Explorer doesn’t always work in Firefox (et al.).

Read More…