Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding JS onClick event to a href tags


jarboy

Recommended Posts

Posted

Hi,

 

I am trying to add an onClick Event to shopping_cart.php

 

I am trying to change this:

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>

 

I thought this was correct:

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" onclick="transferData(this, \'link\');">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>

 

But I get error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\wamp\www\oscommerce-2.2rc2a\oscommerce-2.2rc2a\catalog\shopping_cart.php on line 203

 

Is it just incorrect use of quotation marks or is it not the correct way to add this event to osCommerce scripts?

 

Thanks, Jarboy

Posted
Is it just incorrect use of quotation marks or is it not the correct way to add this event to osCommerce scripts?

 

since you're getting a php error, that indicates a problem with quotation marks. once the php is working, the html will do it's thing. whether or not your onclick event works correctly can be determined once php can parse your code correctly.

 

i hope this helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...