May be your problem is 'on' method.Instead of that use 'live'.If your jQuery is older than 1.7 then 'on' method is not working.So try with 'live' method.
$('#example tbody td img').live('click', function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_close') )
{
this.src = "../examples_support/details_open.png";
oTable.fnClose( nTr );
}
else
{
this.src = "../examples_support/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
}
} );
I hope this will help to you.