[eluser]Kindari[/eluser]
I do things a little differently, so that all my links are backwards compatible. I made an entire version of my site that works without javascript on.
For all my links, I do:
Code:
<?php echo anchor('page.html', 'Some Page', jslink("ajax('page.html')")) ?>
jslink() simply creates an attribute of alt="java-script:{$param}"
Code:
<?php function jslink($item) {return "alt=\"java-script:{$item}\"";} ?>
(obviously remove hypen from the function call.)
Finally to get all of these links to work when javascript is enabled.
Code:
$("a[alt]").attr("href",function(index, Element) { return $(this).attr('alt'); });
(using jquery).
Now note, alt is not officially a supported attribute for the a tag, so validation will fail. But I dont really like the onclick methods, I just thought Id share to give you other ideas of how to accomplish.