Well, maybe all is not lost. How about this, which uses jQuery inside the function. Then you could call your plugin, I bet. Still not the best, but perhaps it will work.
<html> <head> <title>Test Page</title> <script src='jquery.js' type='text/javascript'></script> <script type="text/javascript"> $(function() { $('a.detailLink').click( function(event) { //stop the events default action and propagation. event.stopPropagation(); event.preventDefault(); //run custom function. //cutsom_function(parameters); } ); }); function custom_function(obj, varone, vartwo, varthree, varfour, varfive) { var elem = $(obj); alert("This: " + elem.attr('id') + "\n" + "varone: " + varone + "\n" + "vartwo: " + vartwo + "\n" + "varthree: " + varthree + "\n" + "varfour: " + varfour + "\n" + "varfive: " + varfive ); } </script> </head> <body> <a id='link1' class="detailLink" href="#" onclick="custom_function(this,1,2,3,4,5); return false;">More Details</a> </body> </html> Joe On Wed, Nov 11, 2009 at 2:52 PM, Matthew <mvbo...@gmail.com> wrote: > Thanks for the help Joe. Originally most of the on-page script was > just javascript, but the function call was to a custom jQuery plugin. > I did a modified version of what you suggested and rewrote the plugin > to just be basic functions with parameters. Seems to work now, I'm > just bummed I couldn't keep the jQuery plugin because IE7 decided it > wasn't going to let it work with onclick. > > Thanks again. > > On Nov 11, 11:17 am, Joe Moore <joe.lynn.mo...@gmail.com> wrote: > > Mmm... I'm thinking there's a better way to do it, but as I'm not > familiar > > with the code you are dealing with, here's what I came up with, basically > > you aren't using jQuery. > > > > <html> > > <head> > > <title>Test Page</title> > > <script src='jquery.js' type='text/javascript'></script> > > <script type="text/javascript"> > > $(function() { > > $('a.detailLink').click( > > function(event) { > > //stop the events default action and propagation. > > event.stopPropagation(); > > event.preventDefault(); > > //run custom function. > > //cutsom_function(parameters); > > } > > ); > > > > }); > > > > function custom_function( varone, vartwo, varthree, varfour, > > varfive) > > { > > alert("varone: " + varone + "\n" + > > "vartwo: " + vartwo + "\n" + > > "varthree: " + varthree + "\n" + > > "varfour: " + varfour + "\n" + > > "varfive: " + varfive ); > > } > > </script> > > </head> > > <body> > > <a id='link1' class="detailLink" href="#" > > onclick="custom_function(1,2,3,4,5); return false;">More Details</a> > > </body> > > </html> > > > > Joe > > > > On Wed, Nov 11, 2009 at 2:06 PM, Matthew <mvbo...@gmail.com> wrote: > > > I'm passing about 5 parameters to the function that are coming from > > > php running in a loop. So I was thinking I needed to use the onclick > > > on the <a> tag so that I could just pass the php variables as > > > parameters right there in the loop instead of storing them somehow and > > > referencing them after the page load. > > > > > On Nov 11, 10:54 am, Joe Moore <joe.lynn.mo...@gmail.com> wrote: > > > > Is there some reason you don't want to put this onclick event in a > script > > > > tag in the head section? Like, > > > > > > <html> > > > > <head> > > > > <title>Test Page</title> > > > > <script src='jquery.js' type='text/javascript'></script> > > > > <script type="text/javascript"> > > > > $(function() { > > > > $('a.detailLink').click( > > > > function(event) { > > > > //stop the events default action - stops > click. > > > > event.preventDefault(); > > > > //stop propagation so the event doesn't > bubble > > > up. > > > > event.stopPropagation(); > > > > //run custom function. > > > > cutsom_function(parameters); > > > > } > > > > ); > > > > }); > > > > </script> > > > > </head> > > > > <body> > > > > <a id='link1' class="detailLink" href="#">More Details</a> > > > > </body> > > > > </html> > > > > > > HTH, > > > > > > Joe > > > > > > On Wed, Nov 11, 2009 at 1:14 PM, Matthew <mvbo...@gmail.com> wrote: > > > > > I posted this earlier, but perhaps I didn't explain it right. > > > > > > > Im trying to get code that uses this syntax to work in IE6/7 > > > > > > > <a href="some link" onclick="$(this).function(parameters); return > > > > > false;"> > > > > > > > It seems like IE6/7 do not like the $(this).function syntax, > although > > > > > if I just alert($(this)) I get [object Object] which I think is > what > > > > > should be expected. > > > > > > > I am using a custom jQuery plugin. A watered down version can be > seen > > > > > here:http://jsbin.com/ehoxu > > > > > > > Thanks in advance. > > > > >