40种网页常用小技巧(javascript)
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return false;" 防止复制
5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标
6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标
7. <input style="ime-mode:disabled"> 关闭输入法
8. 永远都会带着框架
<script language="javascript"><!--
if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
// --></script>
9. 防止被人frame
<SCRIPT LANGUAGE=javascript><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
10. 网页将不能被另存为
<noscript><iframe src=*.html></iframe></noscript>
11. <input type=button value=查看网页源代码
onclick="window.location = "view-source:"+ "http://www.gonet8.com"">
12.删除时确认
<a href="javascript:if(confirm("确实要删除吗?"))location="boos.asp?&areyou=删除&page=1"">删除</a>
&nb
相关文档:
Every Web developer has to tangle with tables. A new open source library, DisplayTag, can make life with tables much more organized. Find out how to combine the DisplayTag library with JavaScript to make a slick app that displays line item details.
by Stephen Strenn
isplaying data in a t ......
1、运算符++为累加,若x=5,y=++x,则y=6;运算符- -为递减,若x=5,y=--x,则y=4
2、条件运算符:greeting=(visitor= =”PRES”)?”Dear President”:”Dear”;
如果变量visitor中的值是“PRES”,则向变量greeting赋值“Dear President”,否则赋值“Dear” ......
注:"elm"代表某个DOM元素,"xxx"代表某个CSS属性
一、elm.style.xxx 只能获取内联样式里的值
要想获得正确的css值:
IE:elm.currentStyle[xxx]
W3C标准:document.defaultView.getComputedStyle(elm,"")[xxx]
注意:用IE方法返回值可能不是数字,而是auto;用w3c的方法总是会返回数字+单位
三、offsetLeft
......
网速很慢,但又得打开 Flash 是一件很痛苦的事情,特别是 Silverlight 来临之际,这个技术可能有点用
具体代码如下
<SCRIPT LANGUAGE="JavaScript">
var starttime = new Date()
</SCRIPT>
<img src="images/ConvLogo.JPG?id=<%Int(37462 * Rnd +&n ......