日期:2014-05-16  浏览次数:20304 次

javascript实用代码

?

1、彻底屏蔽鼠标右键,可用于Table
<code lang='html' width='auto' height='auto'><table oncontextmenu='return false'></table></code>

2、取消选取、防止复制
<code lang='html' width='auto' height='auto'><body onselectstart="return false"/></code>

3、禁用复制、粘贴、剪切
<code lang='javascript' width='auto' height='auto'>onpaste="return false" oncopy="return false;" oncut="return false;"</code>

4、在收藏夹中显示出你的图标
<code lang='html' width='auto' height='auto'><link rel="Bookmark" href="favicon.ico"/></code>

5、关闭输入法
<code lang='html' width='auto' height='auto'><input style="ime-mode:disabled"/></code>
<!--more-->

6、永远都会带着框架
<code lang='javascript' width='auto' height='auto'><script language="JavaScript"><!--if(window == top)top.location.href = "frames.htm"; //frames.htm为框架网页// --></script></code>

7、防止被人frame
<code lang='javascript' width='auto' height='auto'><script LANGUAGE=JAVASCRIPT><!--
if(top.location != self.location)top.location=self.location;
// --></script></code>

8、网页将不能被另存为
<code lang='html' width='auto' height='auto'><noscript><iframe src=*.html></iframe></noscript></code>

原文地址:javascript实用代码?|?http://orgcent.com/javascript-snippets/