总结下一些技巧性js代码
- 实现页面最大化
self.moveTo(0,0); self.resizeTo(screen.availWidth,screen.availHeight);
self.focus();
- 默认img图片
<img alt=""" " onerror=""error.jpg" " src=""mengzhaobin.jpg"" />如果没有mengzhaobin.jpg则显示error.jpg
- 屏蔽鼠标右键
oncontextmenu="window.event.returnvalue=false"
- 取消选取防止复制
![](http://laohekou.net/room/Images/OutliningIndicators/None.gif)
- 不准粘贴
onpaste="return false"
- 防止复制
oncopy="return false;" oncut="return false;"
- 地址栏和收藏夹前有图标
![](http://laohekou.net/room/Images/OutliningIndicators/None.gif)
- 关闭输入法
<input style="ime-mode:-Disabled">
- 防止被人frame
if (top.location != self.location)top.location=self.location;
- 网页不能另存为
<noscript><iframe src="*.html"><iframe><noscript>
- 查看页面源代码
![](http://laohekou.net/room/Images/OutliningIndicators/None.gif)
- 弹出对话框并跳转
<a href=`javascript:if(confirm("delete?"location="http://laohekou.net"`>删除a>
- 弹出窗口在最上面
![](http://laohekou.net/room/Images/OutliningIndicators/None.gif)
- 上一页来源
document.referrer
- 没有缓存
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
or <META HTTP-EQUIV="expires" CONTENT="0">
- 不要滚动条
没有竖条<body style=`overflow:-Scroll;overflow-y:hidden`> body>
没有横条: <body style=`overflow:-Scroll;overflow-x:hidden`> body>
两个都没:<body scroll="no">body>