return false in your <a href> tag.
<a href="#" onclick="doFunction(args); return false;">foo</a>
On 12/19/06, Joshua Cyr <[EMAIL PROTECTED]> wrote:
> I am playing with YUI and spry and have a fun task of having content from
> other pages load into a tab system in spry. All is working well so far.
> Next I have event listener code to check for the click of any link in that
> tab content area (which is a separate file). Those links are just normal
> links with no onclick or anything. If you click on it load that linked
> pages data into the tab. That also works.
>
> What I am stuck on now is how to get the page to then stop going to the new
> page. In other words if the link goes to 'aboutus.cfm' I can get the
> content of aboutus.cfm to load into the tab content area, but the page then
> reloads fully to go to the aboutus.cfm page.
>
> Basically clicking on a link will trigger the function below which needs to
> stop the default behavior of opening a new page.
>
> I use return false; in my function, but that only cancel's things in IE7 and
> not firefox. I also tried return(false); with same result.
>
> Relevant JS is:
>
> function clickHandler(e) {
> var elTarget = YAHOO.util.Event.getTarget(e); // sets the var with the
> href of the new page
> Spry.Utils.updateContent('apDiv1',elTarget); // updates my div with new
> content
> return(false); // try to stop browser from opening new page
> }
> YAHOO.example.init = function() {
> YAHOO.util.Event.on(YAHOO.util.Dom.getElementsByClassName('joshua',
> 'div')[0], "click", clickHandler);
> }
>
>
> Joshua Cyr
> Savvy Software
> 866.870.6358
> <http://www.besavvy.com/> www.besavvy.com
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264480
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4