Original URL: http://zhidao.baidu.com/link?url= Nbezzyd1tkttvqv4fq92vdneq2krre7mu0cxn65ivieb1b4sc-jlqcmmu8u4c3jw3s5y2mhxe_ls77kp0-nnr_
Completely prohibit viewing Web page source code
Block out the right-click, copy, and select the complete code:
<script>
Document.oncontextmenu=new Function ("return false")
Document.onselectstart=new Function ("return false")
</script>
Select text or right-click to see
Or
<body oncontextmenu= "return false" onselectstart= "return false" >
Select text or right-click to see
How to View source code
----to prevent visitors from viewing the source code of the Web page, first look at how to view the source code (IE 5.0 for example). One is the right-click menu mode; Second, the Window menu bar viewing mode, that is, select "View" * "source file" mode. To completely prohibit visitors from viewing the source code of the Web page, you must block these 2 ways to view the source code.
Screen right-click menu viewing mode
----Now, many Web pages use the following code to screen the right-click menu:
< Script language=javascript>
function Click () {
if (event.button==2) {alert
(' Screen right-click menu ');
}}
Document.onmousedown=click;
</script>
"Go" prevents others from viewing the source code of your Web page