1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

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.).

Continue reading Inline Javascript and the defer attribute…

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

Getting started with AJAX / Prototype

I thought it was about time I got into some AJAX, or at least got into making use of some Javascript libraries that work with it. Check out the search feature - pretty snazzy, huh?

I based it on the AJAX search results plugin “Addicted to Live Search” for wordpress by John Nunemaker, and then hacked and customised the Javascript functions to add things like the loading graphic. Suprisingly simple, and one I’ll have to remember to write up in the future.