Click to See Complete Forum and Search --> : Help !!


Shishio Makoto
12-06-2005, 08:40 PM
This code:

<script type="text/javascript">

document.onkeyup = KeyCheck;

function KeyCheck(e)
{

var KeyID = (window.event) ? event.keyCode : e.keyCode;

if (KeyID == 27) //ESC
//close browser window
else
window.location = "<?php echo $_SERVER['SCRIPT_NAME'];?>/"+"<?php echo rand(100,999);?>";

}

</script>
<?php
echo '<div align="center">Press any key</div>';
?>


This code will generate a random url, now I want if user press Esc or some times ( I set ) it will close the browser window, and I want to set a time delay between each times key pressed. Thank for helping.

purefan
12-06-2005, 10:57 PM
this is not the place to ask this, you are asking about javascript in the php section.
Also I dont understand what you want, do you want to track down time?

Shishio Makoto
12-07-2005, 01:17 AM
answer your 1st question:
1. I post in this section because I don't know PHP script or javascript can solve my problem. Are there any PHP function can do ??

answer your 2nd question:
1. Browser window will close when user press esc or when user press key several time that reach a limit I set ( eg: I set you can press 3 times and when you press 4 times it will close window.)
2. I want to set a delay time between each time key is captured to prevent user press key rapidly.

sorry for my poor English :(

NewZealand
12-07-2005, 02:11 AM
It must be done with a client side script as in javascript, Not php, everything you want cant be done in JS. Post there or useteh forums contact us page and ask for your thread to be moved there.