Web Development

Custom Code Library

Over the years, I've ended up building my own libraries which I improve on over time. Below find my most common libraries I am willing to share:

PNGFIX

Source Code: pngfix.js (7.84kb)

Inserting this code, enables PNG support for IE6 automatically for foreground images. Addition of elements with background png images can be added to an array in the "png" object to be processed seperately.

 

AJAX

Source Code: ajax.js (14.84kb)

Example of Javascript:

search = new Object;

search.writeQuery = function(query)
{
// Prepare AJAX query
var url = 'search_ajax?query='+query;

// Execute AJAX query and run "search.writeQueryHtml" on init
ajax.get(url, 'search.writeQueryHtml');
}

search.writeQueryHtml = function(html)
{
// Checking to see if any HTML has been returned
// via the 'html' var yet

if (!html)
{
// Display loading HTML
document.getElementById('query').innerHTML = "Loading..";
}
else
{
// Load in returned HTML
document.getElementById('query').innerHTML = html;
}
}

Example of HTML:

<a href="javascript:search.writeQuery('query')" >Search</a>