Tuesday 21 April 2015

Enable Copy Paste On particular control using java script ( when it did on Body)




//HTML

<asp:TextBox runat="server" ID="TextBox1" onmouseover="removeAllAttrs_onmsover();" onmouseout="ADDAllAttrs_onmsout();"></asp:TextBox>


//SCRIPT

                     function removeAllAttrs_ onmsover() {
                        var element = document.body;
                         for (var i = element.attributes.length; i-- > 0; )
                             element.removeAttributeNode(element.attributes[i]);
                     }
                    
                     function ADDAllAttrs_ onmsout(element) {
                         var body = document.getElementsByTagName('body')[0];
                         body.setAttribute("oncopy", "return false;");
                         body.setAttribute("onpaste", "return false;");
                         body.setAttribute("oncut", "return false;");

                       }                  

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...