Automate Your GIS Application: Initiate | Innovate | Automate

WebDesign – JavaScript – Adding PDF Icon to Links

First Place an icon file in images folder, then put the following code in <head> tag


<script src=”http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js”></script>

<script type=”text/javascript”>

$(document).ready(function() {

$(’a[href^=mailto:]‘).addClass(’mailto’);

$(’a[href$=.pdf]‘).addClass(’pdflink’);

$(’a[href^=http][href*=henry]‘).addClass(’henrylink’);

});

</script>

<style>

.mailto {

background: url(images/mail.png) no-repeat right top;

padding-right: 18px;

}

.pdflink {

background: url(images/pdf_button.png) no-repeat right top;

padding-right: 18px;

}

</style>

You can follow any responses to this entry through the RSS 2.0 feed.