<textarea></textarea>
<script type="text/javascript">
document.body.onkeydown = function(event)
{
event = event || window.event;
//get ctrl+v
if(event.keyCode==86 && event.ctrlKey==true)
{
//create a new textarea here; can use a editable div instead
pastearea = document.createElement( 'textarea' );
//make it invisible
pastearea.style.cssText=' position:absolute;left:-10000px';
pastearea.oninput = function() {
alert(this.value); //do sth else
//after all, delete the element
this.parentNode.removeChild(this);
}
document.body.appendChild( pastearea );
pastearea.focus();
}
}
</script>
截获粘贴内容的方法(FF&chrome)
最新推荐文章于 2020-11-22 17:57:36 发布