Friday, May 25, 2012
Monday, May 14, 2012
Java scipt delay & automatic redirection code
<html>
<head>
<script type="text/javascript">
<!--
function delayer(){
window.location = "../javascriptredirect.php"
}
//-->
</script>
</head>
<body onLoad="setTimeout('delayer()', 10)">
<h2>Prepare to be redirected!</h2>
<p>This page is a time delay redirect, please update your bookmarks to our new
location!</p>
</body>
</html>
Handling the ESC key in java script
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<script type="text/javascript">
function identifyEscKeyPressedEvent(keyEvent)
{
var pressedKeyValue = keyEvent.keyCode;
if(pressedKeyValue == 27)
{
alert("Esc Key is pressed");
}
else
{
alert("You have other Key is pressed");
}
}
</script>
</head>
<body>
<input type="text" name="testName" onkeypress="return identifyEscKeyPressedEvent(event);"/>
</body>
</html>