{"id":205,"date":"2007-07-07T15:09:00","date_gmt":"2007-07-07T07:09:00","guid":{"rendered":"http:\/\/j178.mtgbb.com\/131"},"modified":"2007-07-07T15:09:00","modified_gmt":"2007-07-07T07:09:00","slug":"%e5%b0%81%e9%8e%96%e7%b6%b2%e9%a0%81%e5%85%a7%e5%ae%b9","status":"publish","type":"post","link":"https:\/\/j178.mtgbb.com\/?p=205","title":{"rendered":"\u5c01\u9396\u7db2\u9801\u5167\u5bb9"},"content":{"rendered":"<p>\u7528 Javascript \u4f86\u5c01\u9396\u7db2\u9801\u5167\u5bb9\u7684\u8907\u88fd<\/p>\n<p>\u5305\u542b\u4e09\u9805\u5c01\u9396<br \/>\n1. setInterval(&#8220;window.clipboardData.setData(&#8216;text&#8217;,&#8221;)&#8221;,2)\u00a0 : \u6e05\u9664\u6389\u526a\u8cbc\u7c3f<br \/>\n2. oncontextmenu : \u5c01\u9396\u6ed1\u9f20\u53f3\u9375\u6642\u6703\u89f8\u767c\u4e8b\u4ef6<br \/>\n3. onselectstart : \u5c01\u9396\u9078\u53d6\u62d6\u653e\u4e8b\u4ef6<\/p>\n<p><!--more--><\/p>\n<p>sample code:<\/p>\n<pre lang=\"javascript\" line=\"1\">\n<head>\n<\/head>\n<body onload=setInterval(\"window.clipboardData.setData('text','')\",2) oncontextmenu=\"return false\" onselectstart=\"return false\">\n\n************************************************\n***********To disable right click in the web page**************\n<script language=JavaScript>\nfunction clickIE() {\nif (document.all) {\nreturn false;\n}\n}\nfunction clickNS(e) {\nif (document.layers||(document.getElementById&&!document.all)) {\nif (e.which==2||e.which==3) {\nreturn false;\n}\n}\n}\nif (document.layers) {\ndocument.captureEvents(Event.MOUSEDOWN);\ndocument.onmousedown=clickNS;\n} else {\ndocument.onmouseup=clickNS;\ndocument.oncontextmenu=clickIE;\n}\ndocument.oncontextmenu=new Function(\"return false\")\n<\/script>\n************************************************\n****************To Disable Text Selection***************\n<script language=\"JavaScript1.2\">\nfunction disableselect(e){\nreturn false\n}\nfunction reEnable(){\nreturn true\n}\n\n\/\/if IE4+\ndocument.onselectstart=new Function (\"return false\")\n\n\/\/if NS6\nif (window.sidebar){\ndocument.onmousedown=disableselect\ndocument.onclick=reEnable\n}\n<\/script>\n<\/body>\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7528 Javascript \u4f86\u5c01\u9396\u7db2\u9801\u5167\u5bb9\u7684\u8907\u88fd \u5305\u542b\u4e09\u9805\u5c01\u9396 1. setInterval(&#8220;wi &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[26],"class_list":["post-205","post","type-post","status-publish","format-standard","hentry","category-javascript-vbscript","tag-javascript-2"],"_links":{"self":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts\/205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=205"}],"version-history":[{"count":0,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts\/205\/revisions"}],"wp:attachment":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}