Hi there, thanks for your quick reply. I already mentioned trying both SINGLE quotes and DOUBLE quotes. Both result in escaped quotes, hence this post.
The example you gave results in: <a href="/image/a_link.php?test" class="image" onClick="pageTracker._trackEvent('category', 'action', 'label');"><img src="/img/an_image.jpg" / ></a> Is there something I am overlooking here? Is it just not possible to have Javascript in $html->link() ? :) Kana On Sep 2, 4:03 am, "Dr. Loboto" <[email protected]> wrote: > Use SINGLE QUOTES when need quotes in tag attributes. It is the basics > ofHTML. > > <?php > echo $html->link( > $html->image('an_image.jpg'), > '/image/a_link.php?test', > array( > 'class' => 'image', > 'escape' => false, > 'onClick' => "pageTracker._trackEvent('category', > 'action', 'label');" > ), > false, > false > ); > ?> > > On Sep 2, 12:15 am, Kana <[email protected]> wrote: > > > > > How tonotescapeJavascriptinhtmlhelperlinkwithout having to use > >Javascriptoutside $html->link? > > > I try to achieve: > > - the quotes in the onClick event, either single or double quotes > > > <a href="/image/a_link.php?test" class="image" > > onClick="pageTracker._trackEvent("category", "action", "label");"> > > <img src="/img/an_image.jpg" /> > > </a> > > > But the result I get when viewing pagesource is: > > - note the escaped quotes > > - I tried single and double quotes > > > <a href="/image/a_link.php?test" class="image" > > onClick="pageTracker._trackEvent("category", > > "action", "label");"> > > <img src="/img/an_image.jpg" /> > > </a> > > > I use the following code: > > > <?php > > echo $html->link( > > $html->image('an_image.jpg'), > > '/image/a_link.php?test', > > array('class' => 'image', 'escape' => false, 'onClick' => > > 'pageTracker._trackEvent("category", "action", "label");'), > > false, > > false > > ); > > ?> > > > There must be a way to onClickJavascriptworking inlink? I Googled > > but couldn't find any topic on this. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
