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.
> >
> >
>

Reply via email to