Skip Navigation LinkseWAY Home » Support » Download » Helpful Scripts

Helpful Scripts

eWAY has created several JavaScript functions to help improve the security, and functionality of your website, particularly your payment pages.

Please implement the following scripts where you deem suitable.

Stop Double Clicks - Client side solution

Using the eWAY XML solution the payment page is located on your server in a secure SSL directory. To prevent users from double clicking the "Process Payment" button on your site and then being billed twice, the following JavaScript code should be implemented.

This code only allows a form to be submitted once, if submitted again a dialog is displayed and no further action is taken. This code is provided FREE of charge by eWAY, and can only be used by eWAY merchants linking to eWAY.

<head>
  <title>payment page</title>
  <script language="JavaScript" type="text/javascript" >
  <!
--

  var submitcount = 0;
  function checkFields(){
  if (submitcount == 0) {
//sumbit form
    submitcount ++;  
    return true;
  }
  else {  
    alert("Transaction is in progress.");
    return false;
  }
  }
  
//
-->
  </script>
</head>

<form name="TXNDETAILS" ACTION="payment.asp" METHOD="post" onSubmit="return checkFields()" >
  <input type="submit" value="Process Transaction using eWAY" name="submit22" />
</form>

<table>
  <tr>
    <td align=center>
      <font face="Arial, Helvetica, sans-serif" size="1" color="
#999999">
        <a href="../login/default.aspx" class="footertextlink">Login</a>
        <font color="
#FFCC33">|</font>
        <a href="../ssl/ssl.aspx" class="footertextlink">ssl certs</a>
        <font color="
#FFCC33">|</font>
        <a href="../services/default.aspx" class="footertextlink">Services</a>
        <font color="
#FFCC33">|</font> <a href="../services/features.aspx" class="footertextlink">Features</a>
        <font color="
#FFCC33">|</font> <a href="../support/default.aspx" class="footertextlink">Support</a>
        <font color="
#FFCC33">|</font> <a href="../about/default.aspx" class="footertextlink">About eWAY</a>
        <font color="
#FFCC33">|</font> <a href="../partner/default.aspx" class="footertextlink">Partners Program</a>
        <font color="
#FFCC33">|</font> <a href="../join/default.aspx" class="footertextlink">Join eWAY</a>
        <font color="
#FFCC33">|</font> <a href="../pricing/default.aspx" class="footertextlink">Pricing</a>
        <font color="
#FFCC33">|</font> <a href="../demo/default.aspx" class="footertextlink">Demo</a>
        <font color="
#FFCC33">|</font> <a href="../contact/default.aspx" class="footertextlink">Contact</a>
        <font color="
#FFCC33">|</font> <a href="../about/jobs.aspx" class="footertextlink">Jobs @ eWAY</a>
        <font color="
#FFCC33">|</font> <a href="../about/privacy.aspx" class="footertextlink">Privacy</a>

        <span class="footertext">Web Active Corporation Pty Ltd ACN 086 209 403 - Copyright 1998 - 2006 - ABN 32 086 209 403</span>
      </font>
    </td>
    <td>
      <a href="../about/privacy.asp">
      <img border="0" src="../images/truste/finalmark.gif" width="116" height="31" /></a>
    </td>
  </tr>
</table>

Stop Right Clicks - Client side solution

Another useful piece of Javascript disables users using the right mouse button, which adds another element of security to your web pages by restricting access to the source code, properties, and other aspects.

Add this code between the <head> and </head> tags of your web pages.

<script language="JavaScript" type="text/javascript" >

  if (!document.getElementById){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = clickHandler;
  }

  function clickHandler(e) {
    if (typeof(event) !=
'undefined') var button = event.button;
    else if(typeof(e) !=
'undefined') var button = e.which -1;
    else return false;

    if(button != 2) return;
      alert(
'No right clicking!');
    
    window.focus()
    return false;
  }

</script>

Stop Shift + Clicks - Client side solution

This piece of JavaScript can also stop people from opening links on your web pages in new browser windows. This is most useful if you use frames to add another layer of security to your websites.

Add this code between the <head> and </head> tags of your web pages.

<script language="JavaScript" type="text/javascript" >

function mouseDown(e) {
    var shiftPressed=0;
    if (parseInt(navigator.appVersion)>3) {
      if (navigator.appName=="Netscape")
        shiftPressed=(e.modifiers-0>3);
      else shiftPressed=event.shiftKey;
    
      if (shiftPressed) {
        alert (
'Shift-click is disabled.')
        return false;
      }
    }
    return true;
  }
    
  if (parseInt(navigator.appVersion)>3) {
    document.onmousedown = mouseDown;
  if (navigator.appName=="Netscape")
    document.captureEvents(Event.MOUSEDOWN);
}


</script>

Hide Status Bar Links - Client side solution

This script hides the URL's from appearing in the status bar, at the bottom of your browser, when links are hovered over with the users mouse. This is most useful if you use frames to add another layer of security to your websites.

Add this code between the <head> and </head> tags of your web pages.

<script language="JavaScript" type="text/javascript" >

function hidestatus(){
    window.status=
''
    return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
document.onmouseover=hidestatus
document.onmouseout=hidestatus

</script>