Javascript Programming

Since JavaScript is processed by the client, the Transact e-commerce engine does not affect JavaScript code. You can put JavaScript to effective use in the creation of a seamless, automated Online Store.

  1. Make purchasing suggestions to your clients, based on their actions
  2. Change the FORM destination based upon their choices
  3. Calculate or Modify item totals and shipping costs on the fly

In fact, you can use Transact to generate dynamic JavaScript code, using something like this simple example:

<script type="text/javascript">
<!--
var color = '<!-- INPUT: Color -->';
if (confirm('Do you really want the item in the color ' + color + '?') ) 
{
	change_color(color);
}
// -->
</script>

Using Java or JavaScript to Define Links

Under normal circumstances, Transact will modify links to pass the shopping cart information to the next page. This is done as the page is delivered to the client. If you are generating or changing links dynamically (client-side), you'll need to add this information to the links in the code.

Included here is an example way to store the Session_ID variable for later use in JavaScript (which may also be available to Java programs).

<script type="text/javascript">
<!--
var query_string = '?Session_ID=<!-- SESSION: Session_ID -->';
// -->
</script>

Once this variable is defined, you could use it every time you change a link, like so..

	onMouseOver="document.link['color'].href = 'red.html' + query_string";

Main Menu