Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 preavent copy paste

Author  Topic 

chiragvm
Yak Posting Veteran

65 Posts

Posted - 2006-11-02 : 10:22:47
hi to all

i want to stop paste in my webpage's textbox
<script type="text/javascript" >

var sSave = "";
function fnBeforeCut() {
event.returnValue = false;
}

function fnCut(id) {
event.returnValue = false;
sSave = id.innerText;
id.innerText = "";
}

function fnBeforePaste() {
event.returnValue = false;
}

function fnPaste(id) {
event.returnValue = false;
id.innerText = sSave;
}

</script>

use this script in html textbox

when asp:textbox
txtcpassword.Attributes.Add("onSelectStart", "return false;")
txtcpassword.Attributes.Add("onPaste", "return false;")use this code

it working fine in intenetexplorer(microsoft)
but not work in firefox
please give me a solution it's urgent

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-02 : 10:56:51
1. this is a forum for working scripts.
2. you haven't provided the way you're using your functions.
3. download aptana: http://weblogs.sqlteam.com/mladenp/archive/2006/07/31/10914.aspx
4. use it to develop the javascript there because it shows you which functions will work in IE, FF, Opera, etc
5. google returns nothing?



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-11-02 : 11:03:16
Disabling cutting and pasting on a web page sounds like you are inventing a problem to find a solution for.

In addition, a user can always disable javascript, don't forget, or use other tricks to circumvent such "features" on your pages. Any time you try to implement any sort of security at the client you are vulnerable to hacks.

Can I ask why you are doing this?

- Jeff
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-02 : 11:08:28
isn't it obvious, jeff? to prevet users from pasting things



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-02 : 11:09:53
plus it a cross post:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=74388



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -