Onpaste =返回false,但允许拖放内容 [英] Onpaste=return false but allows Drag and Drop Content
本文介绍了Onpaste =返回false,但允许拖放内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友,
我在页面中放置了一个文本区域.
我给了onpaste = return false,所以不允许用户复制内容.
但是,当将内容拖放到文本区域时,它可以执行操作.
请提出我可以解决的问题.
问候,
AP
解决方案
正如Pankaj建议的,您可以使用以下命令停止放置操作:
ondrop = "
正如您已经建议的,您可以使用以下命令停止粘贴操作:
onpaste = "
您还可以通过在相关元素上使用以下内容来停止用户从网站的任何部分中选择文本:
onselectstart = "
您可以使用以下属性禁用文本框上的放置.
ondrop = "
Dear Friends,
I have placed a textarea in page.
I have given onpaste=return false, So I not allowing the user to copy the content.
But when drag and drop the content in the text area it allows the action.
Kindly suggest what I can do for this issue.
Regards,
AP
解决方案
As Pankaj suggests you can stop the drop action using:
ondrop="return false;"
As you''ve already suggested you can stop the paste action using:
onpaste="return false;"
You can also stop the user selecting text from any part of your website by using the following on the relevant elements:
onselectstart="return false;"
You can use the following property to disable the drops on the textbox.
ondrop="return false;"
这篇关于Onpaste =返回false,但允许拖放内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文