<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>最优良人 &#187; 禁用右键 js</title>
	<atom:link href="http://www.zui88.com/view-tag/%e7%a6%81%e7%94%a8%e5%8f%b3%e9%94%ae-js/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zui88.com/blog</link>
	<description>中山php&#124;最优网络</description>
	<lastBuildDate>Mon, 13 May 2013 04:56:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>禁止页面使用右键的js代码</title>
		<link>http://www.zui88.com/blog/view-3.html</link>
		<comments>http://www.zui88.com/blog/view-3.html#comments</comments>
		<pubDate>Sat, 06 Aug 2011 03:26:08 +0000</pubDate>
		<dc:creator>lin</dc:creator>
				<category><![CDATA[网站前端]]></category>
		<category><![CDATA[禁用右键 js]]></category>

		<guid isPermaLink="false">http://124.173.133.154/blog/?p=3</guid>
		<description><![CDATA[之前有一个客户希望网站的页面禁用右键的点击，希望防止图片被下载（其实感觉没什么必要，懂一点网站知识的人还是可以轻易下载的），下面是js禁止右键的代码： function click(e) { if (document.all) { if (event.button==1&#124;&#124;event.button==2&#124;&#124;event.button==3) { oncontextmenu='return false'; } } if (document.layers) { if (e.which == 3) { oncontextmenu='return false'; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; document.oncontextmenu = new Function("return false;") var travel=true var hotkey=17 /* hotkey即为热键的键值,是ASII码,这里99代表c键 */ if (document.layers) document.captureEvents(Event.KEYDOWN) function gogo(e) { if (document.layers) { if [...]]]></description>
			<content:encoded><![CDATA[<p>之前有一个客户希望网站的页面禁用右键的点击，希望防止图片被下载（其实感觉没什么必要，懂一点网站知识的人还是可以轻易下载的），下面是js禁止右键的代码：<br />
<code><br />
function click(e) {<br />
if (document.all) {<br />
if (event.button==1||event.button==2||event.button==3) {<br />
oncontextmenu='return false';<br />
}<br />
}<br />
if (document.layers) {<br />
if (e.which == 3) {<br />
oncontextmenu='return false';<br />
}<br />
}<br />
}<br />
if (document.layers) {<br />
document.captureEvents(Event.MOUSEDOWN);<br />
}<br />
document.onmousedown=click;<br />
document.oncontextmenu = new Function("return false;")</p>
<p>var travel=true<br />
var hotkey=17 /* hotkey即为热键的键值,是ASII码,这里99代表c键 */<br />
if (document.layers)<br />
document.captureEvents(Event.KEYDOWN)<br />
function gogo(e)<br />
{ if (document.layers) {<br />
if (e.which==hotkey&#038;&#038;travel){<br />
alert("操作错误.或许是您按错了按键!"); } }<br />
else if (document.all){<br />
if (event.keyCode==hotkey&#038;&#038;travel){ alert("操作错误.或许是您按错了按键!"); }}<br />
}</p>
<p>document.onkeydown=gogo </code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zui88.com/blog/view-3.html/feed</wfw:commentRss>
		<slash:comments>213</slash:comments>
		</item>
	</channel>
</rss>
