Thursday, January 08, 2009

Well this week I solved a problem with some highly creative jQuery code. The problem was that IE6 doesnt support images in CSS in an anchor tag. Well I came up with some jQuery code that allows you to easily add images after links with a very high level of control. Far more control than CSS.



This example illustrates that once the document is ready, iterate each anchor tag and check to see if it's pointing at a PDF or an XLS file, if so, replace the HTML inside the anchor tag with the existing content plus the image itself.

This helps considerably when you want to enable this site wide. You can see that I use the .match() function to see if the URL contains that piece of information.

This code works great if you place it in a footer and then enable it site wide. This also has the advantage that you can have different CSS files for different pages and not worry about includes or copying references. This works regardless of what page content is.

The down side to using this is that the images are not SEO friendly because this is done in javascript and not part of the page content itself.
Comments: Post a Comment

Links to this post:

Create a Link

<< Home


Recent Posts


Changes in web hosting
Web Table Sorting (Without the headache)
Google Chart API
1PB Storage, $17,8800 Not bad eh?
Google Chrome Anyone?
Fun IT Stuff
Elegant Parsing Of Servlet Parameters
Gave up on Vista
Do it yourself SEO. Free, Cheap SEO, no strings.
New Websites


Archives

01/01/2005 - 02/01/2005
02/01/2006 - 03/01/2006
03/01/2006 - 04/01/2006
04/01/2006 - 05/01/2006
05/01/2006 - 06/01/2006
09/01/2006 - 10/01/2006
10/01/2006 - 11/01/2006
11/01/2006 - 12/01/2006
12/01/2006 - 01/01/2007
04/01/2007 - 05/01/2007
05/01/2007 - 06/01/2007
01/01/2008 - 02/01/2008
02/01/2008 - 03/01/2008
05/01/2008 - 06/01/2008
06/01/2008 - 07/01/2008
08/01/2008 - 09/01/2008
09/01/2008 - 10/01/2008
11/01/2008 - 12/01/2008
12/01/2008 - 01/01/2009
01/01/2009 - 02/01/2009
02/01/2009 - 03/01/2009
04/01/2009 - 05/01/2009
05/01/2009 - 06/01/2009
07/01/2009 - 08/01/2009
01/01/2010 - 02/01/2010

My Software

Blinky - GBPVR Plugin
PhotoCopy - GBPVR Plugin
QTC - Quick Test Case
rBoop - Rob's Timers

Programming Links

C# Formatter
NSIS

Other Links

Damn Small Linux

Sites I Manage

Do it yourself SEO. Cheap.
Pet Supplies
Dog toy of the month club
SqueakerZ pet Deals
Geocaching Community
Hitch hiker Tracking