Helpful scripts

To make it easy for you to develop secure, user-friendly eCommerce sites, eWAY® provide our partners with a free selection of JavaScripts for useful functions.

Stop Double Clicks

To make it easy for you to develop secure, user-friendly eCommerce sites, we provide our partners with a free selection of JavaScripts for useful functions.

<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>

Stop Right Clicks

When added between the <head> and </head> tags on your website, this script disables 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.

<script language="JavaScript" type="text/javascript" >
  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

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

<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;
  }

  document.onmousedown = mouseDown;
</script>

Hide Status Bar Links

This script prevents URLs from appearing in the status bar at the bottom of the browser when the mouse is hovering over links. This is especially 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>