1. 程式人生 > >HTML頁面禁止選擇、頁面禁止複製、頁面禁止右鍵 收藏

HTML頁面禁止選擇、頁面禁止複製、頁面禁止右鍵 收藏

  HTML頁面禁止選擇、頁面禁止複製、頁面禁止右鍵 收藏
轉自:http://hi.baidu.com/kelebing/blog/item/6f97a602d70489074afb517e.html

view plaincopy to clipboardprint?
oncontextmenu='return false' 
ondragstart='return false'   
onselectstart ='return false'   
onselect='document.selection.empty()'   
oncopy='document.selection.empty()'   
onbeforecopy='return false'   
onmouseup='document.selection.empty()' 
oncontextmenu='return false'
ondragstart='return false'
onselectstart ='return false'
onselect='document.selection.empty()'
oncopy='document.selection.empty()'
onbeforecopy='return false'
onmouseup='document.selection.empty()'

一個更簡單的方法就是在<body>中加入如下的程式碼,這樣滑鼠的左右鍵都失效了.

topmargin="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()"

1.禁止網頁另存為:在<body>後面加入以下程式碼:
<noscript>
<iframe src="*.htm"></iframe>
</noscript>


2.禁止網頁內容複製.貼上:在<body>中加入以下程式碼:
<body onmousemove=/HideMenu()/ oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">


本文來自CSDN部落格,轉載請標明出處:http://blog.csdn.net/popo0027/archive/2009/09/07/4527963.aspx