2008/9/26 Mck <[EMAIL PROTECTED]>: > >> <a href="http://someotherwebsite.com" >> onclick="javascript:myfunction(http://sesam.se/boomerang/category=navigation;subcategory=results;pos=1)">click >> me</a> > > I made a mistake here. > A hunting boomerang looks like: > http://sesam.no/hunting/?category=static&subcategory=home > > So the above snippet should look like > > <a href="http://someotherwebsite.com" > onclick="javascript:myfunction('http://sesam.se/hunting/?category=static&subcategory=home')"> > click me</a> >
There is variant of this solution with the benefit of more readable and maintainable HTML. Use CSS classes to provide the information about your links: <a href="http://somesite.com" class="boomerang boomerang_static_home">Click Me</a> And add the following to any of your javascript files. This attaches a click event to all links having the boomerang classes. Note that the following code requires the prototype javascript framework. document.observe('dom:loaded', function() { $$('.boomerang').each(function(link) { link.classNames().each(function(name) { if (name.startsWith('boomerang_')) { var parts = name.split('_'); link.observe('click', function(event) { new Ajax.Request('/hunting/', { method: 'get', parameters: { category: parts[1], subcategory: parts[2] } }); }); return; } }); }) }); - Magnus _______________________________________________ Kernel-development mailing list [email protected] http://sesat.no/mailman/listinfo/kernel-development
