代码:
<body>
<script type="text/javascript">
//not IE is required
function fncKeyStop(evt)
{
if(!window.event)
{
var keycode = evt.keyCode;
var key = String.fromCharCode(keycode).toLowerCase();
if(evt.ctrlKey && key == "v")
{
evt.preventDefault();
evt.stopPropagation();
}
}
}
</script>
<input onkeydown="fncKeyStop(event)" onpaste="return false" oncontextmenu = "return false;" />
</body>
<script type="text/javascript">
//not IE is required
function fncKeyStop(evt)
{
if(!window.event)
{
var keycode = evt.keyCode;
var key = String.fromCharCode(keycode).toLowerCase();
if(evt.ctrlKey && key == "v")
{
evt.preventDefault();
evt.stopPropagation();
}
}
}
</script>
<input onkeydown="fncKeyStop(event)" onpaste="return false" oncontextmenu = "return false;" />
</body>
已知的问题:不能屏蔽Firefox的菜单栏上的“paste”。:(
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1789564