Current Status

Actively playing with all possible backend services

14 December, 2009

Disable single quote Within Forms

Javascript:


This is a good method taught to me by my friend to disable

any character in the keyboard Within Forms in your web page/ web application.


<html>

<head>

<script language=javascript type=text/javascript>

<!--

function stopRKey(evt) {


var evt = (evt) ? evt : ((event) ? event : null);

// var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

alert(evt.keyCode);

if (evt.keyCode == 39 || evt.keyCode == 222) {return false;}

}


document.onkeypress = stopRKey;

-->

</script>

</head>


<body>test

<textarea rows="5"></textarea>

</body>

</html>


Save above code as html and try type single quote(') in test box !

Some Popular Posts