31.TEXTAREA自适应文字行数的多少
1<textarea cols="27" name="s1" onpropertychange="this.style.posHeight=this.scrollHeight" rows="1">
2</textarea>
32. 日期减去天数等于第二个日期
1<script language="Javascript">
2function cc(dd,dadd)
3{
4//可以加上错误处理
5var a = new Date(dd)
6a = a.valueOf()
7a = a - dadd * 24 * 60 * 60 * 1000
8a = new Date(a)
9alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日")
10}
11cc("12/23/2002",2)
12</script>
33. 选择了哪一个Radio
1<html><script language="vbscript">
2function checkme()
3for each ob in radio1
4if ob.checked then window.alert ob.value
5next
6end function
7</script><body>
8<input checked="" name="radio1" type="radio" value="style"/>Style
9<input name="radio1" type="radio" value="barcode"/>Barcode
10<input onclick="checkme()" type="button" value="check"/>
11</body></html>
34.脚本永不出错
1<script language="JavaScript">
2<!-- Hide
3function killErrors() {
4return true;
5}
6window.onerror = killErrors;
7// -->
8</script>
35.ENTER键可以让光标移到下一个输入框
1<input onkeydown="if(event.keyCode==13)event.keyCode=9"/>
36. 检测某个网站的链接速度:
把如下代码加入
1<body>区域中:
2
3<script language="Javascript">
4tim=1
5setInterval("tim++",100)
6b=1
7var autourl=new Array()
8autourl[1]="www.njcatv.net"
9autourl[2]="javacool.3322.net"
10autourl[3]="www.sina.com.cn"
11autourl[4]="www.nuaa.edu.cn"
12autourl[5]="www.cctv.com"
13function butt(){
14document.write("<form name=autof>")
15for(var i=1;i<autourl.length;i++)
16document.write("<input type=text name=txt"+i+" size=10 value=测试中……> =》<input type=text
17name=url"+i+" size=40> =》<input type=button value=GO
18
19onclick=window.open(this.form.url"+i+".value)><br>")
20document.write("<input type=submit value=刷新></form>")
21}
22butt()
23function auto(url){
24document.forms[0]["url"+b].value=url
25if(tim>200)
26{document.forms[0]["txt"+b].value="链接超时"}
27else
28{document.forms[0]["txt"+b].value="时间"+tim/10+"秒"}
29b++
30}
31function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+"/"+Math.random()+" width=1 height=1
32
33onerror=auto("http://"+autourl+"")>")}
34run()</script>
35
3637\. 各种样式的光标
37
38auto :标准光标
39default :标准箭头
40hand :手形光标
41wait :等待光标
42text :I形光标
43vertical-text :水平I形光标
44no-drop :不可拖动光标
45not-allowed :无效光标
46help :?帮助光标
47all-scroll :三角方向标
48move :移动标
49crosshair :十字标
50e-resize
51n-resize
52nw-resize
53w-resize
54s-resize
55se-resize
56sw-resize
57
58
5938.页面进入和退出的特效
60
61进入页面<meta content="revealTrans(duration=x, transition=y)" http-equiv="Page-Enter"/>
62推出页面<meta content="revealTrans(duration=x, transition=y)" http-equiv="Page-Exit"/>
63这个是页面被载入和调出时的一些特效。duration表示特效的持续时间,以秒为单位。transition表示使用哪种特效,取值为1-23:
640 矩形缩小
651 矩形扩大
662 圆形缩小
673 圆形扩大
684 下到上刷新
695 上到下刷新
706 左到右刷新
717 右到左刷新
728 竖百叶窗
739 横百叶窗
7410 错位横百叶窗
7511 错位竖百叶窗
7612 点扩散
7713 左右到中间刷新
7814 中间到左右刷新
7915 中间到上下
8016 上下到中间
8117 右下到左上
8218 右上到左下
8319 左上到右下
8420 左下到右上
8521 横条
8622 竖条
8723 以上22种随机选择一种
88
8939.在规定时间内跳转
90
91<meta content="5;URL=http://www.51js.com" http-equiv='V="REFRESH"'/>
92
9340.网页是否被检索
94
95<meta content="属性值" name="ROBOTS"/>
96其中属性值有以下一些:
97属性值为"all": 文件将被检索,且页上链接可被查询;
98属性值为"none": 文件不被检索,而且不查询页上的链接;
99属性值为"index": 文件将被检索;
100属性值为"follow": 查询页上的链接;
101属性值为"noindex": 文件不检索,但可被查询链接;
102属性值为"nofollow": 文件不被检索,但可查询页上的链接。</body>