Locking User On Page

[Total: 0    Average: 0/5]

This shows how to lock a user onto a page.

Head Code:

<script type=text/javascript>
onUnload="doIt()";
onReload="_l()";
onFocus="_l()";
onBlur="_l()";
onResize="_l()";

var _lock = true;
var _LOCKED = "Page Locked!";
var _NOT_LOCKED = "You May Leave";
var _NO_WAY = "NO WAY!";
function doIt() {
  if (_lock && document.ef1.t1.value!=_NO_WAY) {
      document.location=document.location
      document.ef1.t1.value = _NO_WAY;
      return false;
  }
  else {
    document.ef1.t1.value = _LOCKED;
    return true;
  }
}
function _l() {
  _lock = true;
  document.ef1.t1.value=_LOCKED;
}
function clickedMe() {
  _lock = false;
  document.ef1.t1.value = _NOT_LOCKED;
}
</script>

Body Code:

<form name="ef1">
Page Locked Status: <input type="text" name="t1" value="Page Locked!"><BR>
<input type=button name="b1" value="LET ME LEAVE" onclick="clickedMe()">
</form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *