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.csdn.net/'">   

12. 怎样通过asp的手段来检查来访者是否用了代理   
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then   
response.write 
"<font color=#FF0000>您通过了代理服务器,"& _   
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")   
end 
if   
%>   

13. 取得控件的绝对位置   

//javascript   
<script language="javascript">   
function getIE(e){   
  
var t=e.offsetTop;   
  
var l=e.offsetLeft;   
  
while(e=e.offsetParent){   
    t
+=e.offsetTop;   
    l
+=e.offsetLeft;   
    }
   
  alert(
"top="+t+"\nleft="+l);   
  }
   
</script>   

//VBScript   
<script language="VBScript"><!--   
function getIE()   
  
dim t,l,a,b   
  
set a=document.all.img1   
  t
=document.all.img1.offsetTop   
  l
=document.all.img1.offsetLeft   
  
while a.tagName<>"BODY"   
    
set a = a.offsetParent   
    t
=t+a.offsetTop   
    l
=l+a.offsetLeft   
  
wend   
  
msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"   
end function   
-->
</script>   

14. 光标是停在文本框文字的最后   
<script language="javascript">   
function cc()   
{   
  
var e = event.srcElement;   
  
var r =e.createTextRange();   
  r.moveStart('character',e.value.length);   
  r.collapse(
true);   
  r.select();   
}
   
</script>   
<input type=text name=text1 value="123" onfocus="cc()">   

15. 判断上一页的来源   
asp:   
request.servervariables("HTTP_REFERER")   

javascript:   
document.referrer   

16. 最小化、最大化、关闭窗口   
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">    
<param name="Command" value="Minimize"></object>   
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">    
<param name="Command" value="Maximize"></object>   
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">   
<PARAM NAME="Command" value="Close"></OBJECT>   

<input type=button value=最小化 onclick=hh1.Click()>   
<input type=button value=最大化 onclick=hh2.Click()>   
<input type=button value=关闭 onclick=hh3.Click()>   
本例适用于IE   

17.    
<%   
'定义数据库连接的一些常量   
Const adOpenForwardOnly     
= 0 '游标只向前浏览记录,不支持分页、Recordset、BookMark   
Const adOpenKeyset          
= 1 '键集游标,其他用户对记录说做的修改将反映到记录集中,但其他用户增加或删除记录不会反映到记录集中。支持分页、Recordset、BookMark   
Const adOpenDynamic         
= 2 '动态游标功能最强,但耗资源也最多。用户对记录说做的修改,增加或删除记录都将反映到记录集中。支持全功能浏览(ACCESS不支持)。   
Const adOpenStatic          
= 3 '静态游标,只是数据的一个快照,用户对记录说做的修改,增加或删除记录都不会反映到记录集中。支持向前或向后移动   

Const adLockReadOnly        
= 1 '锁定类型,默认的,只读,不能作任何修改   
Const adLockPessimistic     
= 2 '当编辑时立即锁定记录,最安全的方式   
Const adLockOptimistic      
= 3 '只有在调用Update方法时才锁定记录集,而在此前的其他操作仍可对当前记录进行更改、插入和删除等   
Const adLockBatchOptimistic 
= 4 '当编辑时记录不会被锁定,而更改、插入和删除是在批处理方式下完成的   

Const adCmdText  
= &H0001   
Const adCmdTable = &H0002   
%>   

18. 网页不会被缓存   
HTM网页   
<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">   
或者
<META HTTP-EQUIV="expires" CONTENT="0">   
ASP网页   
  Response.Expires = -1   
  Response.ExpiresAbsolute = Now() - 1   
  Response.cachecontrol = "no-cache"   
PHP网页   
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");   
header("Cache-Control: no-cache, must-revalidate");   
header("Pragma: no-cache");   


19. 检查一段字符串是否全由数字组成   
<script language="javascript"><!--   
function checkNum(str){return str.match(/\D/)==null}   
alert(checkNum(
"1232142141"))   
alert(checkNum(
"123214214a1"))   
// --></script>   

20. 获得一个窗口的大小   
document.body.clientWidth,document.body.clientHeight   

21. 怎么判断是否是字符   
if (/[^\x00-\xff]/g.test(s)) alert("含有汉字");   
else alert("全是字符");   

22.TEXTAREA自适应文字行数的多少   
<textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">   
</textarea>   

23. 日期减去天数等于第二个日期   
<script language=javascript>   
function cc(dd,dadd)   
{   
//可以加上错误处理   
var a = new Date(dd)   
= a.valueOf()   
= a - dadd * 24 * 60 * 60 * 1000   
= new Date(a)   
alert(a.getFullYear() 
+ "" + (a.getMonth() + 1+ "" + a.getDate() + "")   
}
   
cc(
"12/23/2002",2)   
</script>   

24. 选择了哪一个Radio   
<HTML><script language="vbscript">   
function checkme()   
  
for each ob in radio1   
    
if ob.checked then window.alert ob.value   
  
next   
end function   
</script><BODY>   
<INPUT name="radio1" type="radio" value="style" checked>Style   
<INPUT name="radio1" type="radio" value="barcode">Barcode   
<INPUT type="button" value="check" onclick="checkme()">   
</BODY></HTML>   

25.获得本页url的request.servervariables("")集合   
Response.Write "
<TABLE border=1><!-- Table Header --><TR><TD><B>Variables</B></TD><TD><B>value</B></TD></TR>"   
for each ob in Request.ServerVariables   
Response.Write "
<TR><TD>"&ob&"</TD><TD>"&Request.ServerVariables(ob)&"</TD></TR>"   
next   
Response.Write "
</TABLE>"   

26.   
本机ip
<%=request.servervariables("remote_addr")%>   
服务器名
<%=Request.ServerVariables("SERVER_NAME")%>   
服务器IP
<%=Request.ServerVariables("LOCAL_ADDR")%>   
服务器端口
<%=Request.ServerVariables("SERVER_PORT")%>   
服务器时间
<%=now%>   
IIS版本
<%=Request.ServerVariables"SERVER_SOFTWARE")%>   
脚本超时时间
<%=Server.ScriptTimeout%>   
本文件路径
<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%>   
服务器CPU数量
<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>   
服务器解译引擎
<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>   
服务器操作系统
<%=Request.ServerVariables("OS")%>   

27.ENTER键可以让光标移到下一个输入框   
<input onkeydown="if(event.keyCode==13)event.keyCode=9">   

28. 检测某个网站的链接速度:   
把如下代码加入
<body>区域中:   
<script language=javascript>   
tim=1   
setInterval("tim++",100)   
b
=1   

var autourl=new Array()   
autourl[1]
="www.njcatv.net"   
autourl[2]
="javacool.3322.net"   
autourl[3]
="www.sina.com.cn"   
autourl[4]
="www.nuaa.edu.cn"   
autourl[5]
="www.cctv.com"   

function butt(){   
document.write("<form name
=autof>")   
for(var i=1;i<autourl.length;i++)   
document.write("<input type=text name=txt"+i+" size=10 value=测试中……> =》<input type=text name=url"+i+" size=40> =》<input type=button value=GO onclick=window.open(this.form.url"+i+".value)><br/>")   
document.write("<input type=submit value=刷新></form>")   
}   
butt()   
function auto(url){   
document.forms[0]["url"+b].value
=url   
if(tim>200)   
{document.forms[0]["txt"+b].value="链接超时"}   
else   
{document.forms[0]["txt"+b].value="时间"+tim/10+""}   
b
++   
}   
function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl[i]+"/"+Math.random()+" width=1 height=1 onerror=auto('http://";;;;+autourl[i]+"')>")}   
run()
</script>   

29. 各种样式的光标   
auto          :标准光标   
default       :标准箭头   
hand          :手形光标   
wait          :等待光标   
text          :I形光标   
vertical-text :水平I形光标   
no-drop       :不可拖动光标   
not-allowed   :无效光标   
help          :?帮助光标   
all-scroll    :三角方向标   
move          :移动标   
crosshair     :十字标   
e-resize   
n-resize   
nw-resize   
w-resize   
s-resize   
se-resize   
sw-resize 

第二部分: 
————————————————————————————————————— 


【1、普通的弹出窗口】  
其实代码非常简单:  

<SCRIPT LANGUAGE="javascript">  
<!--  
window.open ('page.html')  
-->  
</SCRIPT>  


 因为这是一段javascripts代码,所以它们应该放在
<SCRIPT LANGUAGE="javascript">标签和</script>之间。<!-- 和 -->是对一些版本低的浏览器起作用,在这些老浏览器中不会将标签中的代码作为文本显示出来。要养成这个好习惯啊。  
 window.open ('page.html') 用于控制弹出新的窗口page.html,如果page.html不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。  
 用单引号和双引号都可以,只是不要混用。  
 这一段代码可以加入HTML的任意位置,
<head></head>之间可以,<body></body>也可以,越前越早执行,尤其是页面代码长,又想使页面早点弹出就尽量往前放。  

 【2、经过设置后的弹出窗口】  
 下面再说一说弹出窗口的设置。只要再往上面的代码中加一点东西就可以了。我们来定制这个弹出的窗口的外观,尺寸大小,弹出的位置以适应该页面的具体情况。  

<SCRIPT LANGUAGE="javascript">  
<!--  
window.open ('page.html', 'newwindow', 'height
=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')  
//写成一行  
-->  
</SCRIPT>  

 参数解释:  


<SCRIPT LANGUAGE="javascript"> js脚本开始;  
window.open 弹出新窗口的命令;  
'page.html' 弹出窗口的文件名;  
'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;  
height
=100 窗口高度;  
width
=400 窗口宽度;  
top
=0 窗口距离屏幕上方的象素值;  
left
=0 窗口距离屏幕左侧的象素值;  
toolbar
=no 是否显示工具栏,yes为显示;  
menubar,scrollbars 表示菜单栏和滚动栏。  
resizable
=no 是否允许改变窗口大小,yes为允许;  
location
=no 是否显示地址栏,yes为允许;  
status
=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;  
</SCRIPT> js脚本结束  

 【3、用函数控制弹出窗口】  
 下面是一个完整的代码。  
<html>  
<head>  
<script LANGUAGE="javascript">  
<!--  
function openwin() {  
window.open (
"page.html""newwindow""height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")  
//写成一行  
}
  
//-->  
</script>  
</head>  
<body onload="openwin()">  
..任意的页面内容  
</body>  
</html>  

 这里定义了一个函数openwin(),函数内容就是打开一个窗口。在调用它之前没有任何用途。  
怎么调用呢?  


 方法一:
<body onload="openwin()"> 浏览器读页面时弹出窗口;  
 方法二:
<body onunload="openwin()"> 浏览器离开页面时弹出窗口;  
 方法三:用一个连接调用:  
<href="注意:使用的“ 方法四:用一个按钮调用:  
<input type="
button" onclick="openwin()" value="打开窗口">  

 【4、同时弹出2个窗口】  


 对源代码稍微改动一下:  
<script LANGUAGE="javascript">  
<!--  
function openwin() {  
window.open (
"page.html""newwindow""height=100, width=100, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")  
//写成一行  
window.open ("page2.html""newwindow2""height=100, width=100, top=100, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")  
//写成一行  
}
  
//-->  
</script>  


 为避免弹出的2个窗口覆盖,用top和left控制一下弹出的位置不要相互覆盖即可。最后用上面说过的四种方法调用即可。  
注意:2个窗口的name(newwindows和newwindow2)不要相同,或者干脆全部为空。OK?  

 【5、主窗口打开文件1.htm,同时弹出小窗口page.html】  

 如下代码加入主窗口
<head>区:  

<script language="javascript">  
<!--  
function openwin() {  
window.open(
"page.html","","width=200,height=200")  
}
  
//-->  
</script>  
加入
<body>区:  
<href="1.htm" onclick="openwin()">open</a>即可。  

 【6、弹出的窗口之定时关闭控制】  

 下面我们再对弹出的窗口进行一些控制,效果就更好了。如果我们再将一小段代码加入弹出的页面(注意是加入到page.html的HTML中,可不是主页面中,否则),让它10秒后自动关闭是不是更酷了?  


 首先,将如下代码加入page.html文件的
<head>区:  
<script language="javascript">  

function closeit() {  

setTimeout(
"self.close()",10000//毫秒  

}
  

</script>  
 然后,再用
<body onload="closeit()"> 这一句话代替page.html中原有的<BODY>这一句就可以了。(这一句话千万不要忘记写啊!这一句的作用是调用关闭窗口的代码,10秒钟后就自行关闭该窗口。)  

 【7、在弹出窗口中加上一个关闭按钮】  
<FORM>  
<INPUT TYPE='BUTTON' value='关闭' onClick='window.close()'>  
</FORM>  
呵呵,现在更加完美了!  

 【8、内包含的弹出窗口-一个页面两个窗口】  

上面的例子都包含两个窗口,一个是主窗口,另一个是弹出的小窗口。  
通过下面的例子,你可以在一个页面内完成上面的效果。  

<html>  
<head>  
<SCRIPT LANGUAGE="javascript">  
function openwin()  
{  
OpenWindow
=window.open("""newwin""height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");  
//写成一行  
OpenWindow.document.write("<TITLE>例子</TITLE>")  
OpenWindow.document.write(
"<BODY BGCOLOR=OpenWindow.document.write("<h1>Hello!</h1>")  
OpenWindow.document.write(
"New window opened!")  
OpenWindow.document.write(
"</BODY>")  
OpenWindow.document.write(
"</HTML>")  
OpenWindow.document.close()  
}  
</SCRIPT>  
</head>  
<body>  
<a href=
"<input type="button" onclick="openwin()" value="打开窗口">  
</body>  
</html>  

 看看 OpenWindow.document.write()里面的代码不就是标准的HTML吗?只要按照格式写更多的行即可。千万注意多一个标签或少一个标签就会出现错误。记得用OpenWindow.document.close()结束啊。  


 【
9、终极应用--弹出的窗口之Cookie控制】  

 回想一下,上面的弹出窗口虽然酷,但是有一点小毛病(沉浸在喜悦之中,一定没有发现吧?)比如你将上面的脚本放在一个需要频繁经过的页面里(例如首页),那么每次刷新这个页面,窗口都会弹出一次,是不是非常烦人?:
-(  
 有解决的办法吗?Yes
! ;-) Follow me.  
 我们使用cookie来控制一下就可以了。  
 首先,将如下代码加入主页面HTML的
<HEAD>区:  

<script>  
function openwin(){  
window.open(
"page.html","","width=200,height=200")  
}
  
function get_cookie(Name) {  
var search = Name + "="  
var returnvalue = "";  
if (documents.cookie.length > 0{  
offset 
= documents.cookie.indexOf(search)  
if (offset != -1{  
offset 
+= search.length  
end 
= documents.cookie.indexOf(";", offset);  
if (end == -1)  
end 
= documents.cookie.length;  
returnvalue
=unescape(documents.cookie.substring(offset, end))  
}
  
}
  
return returnvalue;  
}
  

function loadpopup(){  
if (get_cookie('popped')==''){  
openwin()  
documents.cookie
="popped=yes"  
}
  
}
  

</script>  

 然后,用
<body onload="loadpopup()">(注意不是openwin而是loadpop啊!)替换主页面中原有的<BODY>这一句即可。你可以试着刷新一下这个页面或重新进入该页面,窗口再也不会弹出了。真正的Pop-Only-Once!  

 写到这里弹出窗口的制作和应用技巧基本上算是完成了,俺也累坏了,一口气说了这么多,希望对正在制作网页的朋友有所帮助俺就非常欣慰了。  
 需要注意的是,JS脚本中的的大小写最好前后保持一致。 
06.打开窗口即最大化 
<script language="javascript">  
<!-- Begin  
self.moveTo(
0,0
self.resizeTo(screen.availWidth,screen.availHeight) 
// End -->  
</script> 

12.细线分隔线 

<hr noshade size=0 color=#C0C0C0> 
13.过度方式 

<meta http-equiv
="Page-Exit" content="revealTrans(Duration=3,Transition=5)"> 
Duration的值为网页动态过渡的时间,单位为秒。 
Transition是过渡方式,它的值为0到23,分别对应24种过渡方式。如下表: 
0 盒状收缩 1 盒状放射 
2 圆形收缩 3 圆形放射 
4 由下往上 5 由上往下 
6 从左至右 7 从右至左 
8 垂直百叶窗 9 水平百叶窗 
10 水平格状百叶窗 11垂直格状百叶窗 
12 随意溶解 13从左右两端向中间展开 
14从中间向左右两端展开 15从上下两端向中间展开 
16从中间向上下两端展开 17 从右上角向左下角展开 
18 从右下角向左上角展开 19 从左上角向右下角展开 
20 从左下角向右上角展开 21 水平线状展开 
22 垂直线状展开 23 随机产生一种过渡方式 


15.如何控制横向和纵向滚动条的显隐? 
<body style="overflow-y:hidden"> 去掉x轴 
<body style="overflow-x:hidden"> 去掉y轴 
<body scroll="no">不显  

16.怎样在 FrontPage2000 中加入 Flash 动画?  
在 FrontPage2000 中,点击[插入]->[高级]->[插件],在弹出的窗口中,设置一下 Flash 文件的大小及其它信息,确定即可。  

17.加入注释的格式是:     
〈!-[注释内容…]--〉  

18.怎样在网页中加入 E-mail 链接并显示预定的主题?  
〈A href="mailto:Emailhost@263.net?subject=主题"〉……〈/a〉  

19.定义本网页关键字,可以在〈Head〉〈/Head〉中加入如下代码:  

〈meta name="Keywords" content="china,enterprise,business,net"〉     
Content 中所包含的就是关键字,你可以自行设置。     
这里有个技巧,你可以重复某一个单词,这样可以提高自己网站的排行位置,如:  
〈meta name="Keywords" content="china,china,china,china"〉  

20.IE5.0 的部分快捷键:  
A:打开查找功能:Ctrl+F  
关闭浏览器窗口:Ctrl+W  
打开地址栏下拉列表框:F4  
刷 新:F5  
将当前Web页保存到收藏夹列表:Ctrl+D  
打开当前 IE 窗口的一个拷贝:Ctrl+N  
停止下载当前网页:Esc  
光标迅速移动到网页的开头:Home  
光标迅速移动到网页的尾部:End  
打开新的地址键入窗口:Ctrl+O  
打开收藏夹:Ctrl+I  
打开历史记录文件夹:Ctrl+H  
打开浏览器设定的默认主页:Alt+HOME  


21.添加到收藏夹: 
〈a href="javascript:window.external.addFavorite('http://链接','说明');"〉添加到收藏夹〈/a〉 

22.设为首页: 

〈a href=# onclick=this.style.behavior='url(#default#homepage)';this.setHomePage('http://链接');〉设为首页〈/a〉  

23.定制浏览器地址栏前的小图标: 


A:在网页的〈head〉〈/head〉间加入以下语句: 
〈link rel="shortcuticon" href="http://…/icon.ico"〉 
即可。其中 icon.ico 为 16x16 的图标文件,颜色不要超过 16 色。  


24.把滚动条放在浏览器窗口的左边 


A:在 
<body> 中加 dir=RTL,即 <body dir=RTL>。 

<table><tr>  
     
<td id="mainview"> 
     
<iframe src="http://192.168.0.44/announce.asp?boardid=25"; width="100%" height="100%" name="main" scrolling="no" border="0" frameborder="0"> 
     这里是内框架,如果看不到请升级你的IE。
</iframe></td> 
    
</tr></table> 
<script language="javascript" for="main" event="onload"> 
mainview.height
=main.document.body.scrollHeight+10
</script> 
<Script Language=Jscript> 
alert(clipboardData.getData('text'))  //取得当前的剪切版内容 
window.clipboardData.setData('text','指定数据') //自定义剪切版中的内容 
alert(clipboardData.getData('text')) //在次取得当前剪切版内容 
</Script
> 
<HTML> 
<HEAD> 
<script language="javascript1.2"> 
// All Codez Modifed & Writen By Windy_sk, 
//
 You Can Use It Freely , But You Must Hold This Item ! 

var Card_list = new Array(); 

function Cardz(title,content) 
this.title = title; 
this.content = content; 
}
 

//You can add the url list you wanted, format as below; 

Card_list[
0= new Cardz("表单","<form action=''>性别:<input type=radio checked name=sex>男<input name='sex' type=radio>女<br>姓名:<input name='name'><br>工作:<select name='job'><option>待业</option><option>在学</option><option>工作</option></select><br><input type=submit><form>"); 
Card_list[
1= new Cardz("图片","<img src=http://www.agriffchina.com/pic/banner1.gif width=350 height=60>"); 
Card_list[
2= new Cardz("iFrame","<iframe style='filter:flipV()' src='http://www.sina.com.cn' width=400 height=90% marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=1></iframe>"); 
Card_list[
3= new Cardz("表格","<table border=1 width=100%><td>表格</td></tr><tr><td>111111111111</td></tr><tr><td>222222222222</td></tr></table>"); 
Card_list[
4= new Cardz("滚动字幕","<marquee> 滚动字幕 </marquee>"); 

var Num = Card_list.length; 
var cur_card = 1

function document.onmousedown()
var obj=event.srcElement 
var pobj=obj.parentElement.id; 
if(obj.className=="span")
for(i=1;i<=Num+1;i++)

if(pobj==("btn"+i))
document.all(
"td"+i).style.backgroundColor = "menu"
document.all(
"btn"+i).style.height = 20
if(i!=cur_card)content(i) 
cur_card 
= i; 
}
else
if(i<=Num)
document.all(
"td"+i).style.backgroundColor = "white"
document.all(
"btn"+i).style.height = 18
}
 
}
 
}
 
}
  
}
 


function content(i)
Content.innerHTML 
= Card_list[i-1].content 
}
 

function init()
for(i=1;i<=Num;i++
document.all(
"MenuName"+i).innerText = Card_list[i-1].title; 
content(
1); 
}
 

</script> 

<style> 
td
{font-size:9pt} 
.span
{ 
cursor
:default; 
padding-left
:5; 
padding-top
:2; 
padding-right
:5; 
padding-bottom
:0; 
width
:70px; 
height
:100%; 
TEXT-ALIGN
: center; 
}
 
</style> 
<TITLE>Table_Card</TITLE> 
<META http-equiv="content-type" content="text/html;charset=gb2312"> 
</HEAD> 
<BODY bgcolor=#FFFFFF onload=init()> 
<p> 
<table width=0 align=center><tr><td> 
<table cellpadding=0 cellspacing=0> 
<tr height=20 onselectstart="return false"> 
<script language="javascript1.2"> 
for(i=1;i<=Num;i++)
tdBody
="<td valign=bottom>" 
tdBody
+="<table cellspacing=0 cellpadding=0 bgcolor='menu'>" 
tdBody
+="<tr>" 
tdBody
+="<td width=1 height=1><\/td><td width=1 height=1><\/td>" 
tdBody
+="<td bgcolor=white><\/td><td></td><td></td>" 
tdBody
+="<\/tr>" 
tdBody
+="<tr><td width=1 height=1><\/td><td width=1 height=1 bgcolor=white><\/td>" 
tdBody
+="<td></td><td bgcolor=black><\/td><td></td>" 
tdBody
+="<\/tr>" 
tdBody
+="<tr><td width=1 bgcolor=white><\/td><td width=1 height=1><\/td>" 
tdBody
+="<td id=btn"+i+" height=18><span class=span id=MenuName"+i+">title<\/span></td><td width=1 bgcolor=gray><\/td><td bgcolor=black width=1><\/td>" 
tdBody
+="<\/tr>" 
tdBody
+="<tr><td bgcolor=white><\/td><td colspan=4 height=1 bgcolor=white id=td"+i+"><\/td>" 
tdBody
+="<\/tr>" 
tdBody
+="<\/table>" 
tdBody
+="<\/td>"
document.write(tdBody) 
}
 
document.all(
"td1").style.backgroundColor = "menu"
document.all(
"btn1").style.height = 20
</script> 
<td style="border-bottom:1 white solid" width="50"></td> 
</tr> 
</table> 
<div style="BACKGROUND-COLOR: menu;padding:10;width:100%;height:200;border-left:1 white solid;border-right:2 outset;border-bottom:2 outset"> 
<span id=Content>Content</span> 
</div> 
</td></tr></table> 
</BODY> 
</HTML>  
<HTML xmlns:v> 
<STYLE> 
v\:*
{behavior:url(#default#VML);} //声明变量v为VML对象 
</STYLE> 
<BODY> 
<v:RoundRect stroked='false' fillcolor='green' style='width:180;height:100'/>  


使用FSO修改文件特定内容的函......
使用FSO修改文件特定内容的函数
function FSOchange(filename,Target,String)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FiletempData = objCountFile.ReadAll
objCountFile.Close
FiletempData=Replace(FiletempData,Target,String)
Set objCountFile=objFSO.CreateTextFile(Server.MapPath(filename),True)
objCountFile.Write FiletempData 
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
End Function
''''
使用FSO读取文件内容的函数

function FSOFileRead(filename)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FSOFileRead = objCountFile.ReadAll
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
End Function

''''
使用FSO读取文件某一行的函数

function FSOlinedit(filename,lineNum)
if linenum < 1 then exit function
dim fso,f,temparray,tempcnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
set f = nothing
temparray = split(tempcnt,chr(13)&chr(10))
if lineNum>ubound(temparray)+1 then
  exit function
else
  FSOlinedit = temparray(lineNum-1)
end if
end if
end function

''''
使用FSO写文件某一行的函数

function FSOlinewrite(filename,lineNum,Linecontent)
if linenum < 1 then exit function
dim fso,f,temparray,tempCnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
temparray = split(tempcnt,chr(13)&chr(10))
if lineNum>ubound(temparray)+1 then
  exit function
else
  temparray(lineNum-1) = lineContent
end if
tempcnt = join(temparray,chr(13)&chr(10))
set f = fso.createtextfile(server.mappath(filename),true)
f.write tempcnt
end if
f.close
set f = nothing
end function

''''
使用FSO添加文件新行的函数

function FSOappline(filename,Linecontent)
dim fso,f
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),8,1)
f.write chr(13)&chr(10)&Linecontent
f.close
set f = nothing
end function

''''
读文件最后一行的函数

function FSOlastline(filename)
dim fso,f,temparray,tempcnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
set f = nothing
temparray = split(tempcnt,chr(13)&chr(10))
  FSOlastline = temparray(ubound(temparray))
end if
end function

'
还有,创建文件夹:

sub CreateFolder(Foldername)
Set afso = Server.CreateObject("Scripting.FileSystemObject")
  if afso.folderexists(server.mappath(Foldername))=true then
  else
   afso.createfolder(server.mappath(foldername))
  end if
set afso=nothing
end sub

'
用法,createfolder(foldername)

遍历目录以及目录下文件的函数
function bianli(path)
set fso=server.CreateObject("scripting.filesystemobject") 

on error resume next
set objFolder=fso.GetFolder(path)

set objSubFolders=objFolder.Subfolders

for each objSubFolder in objSubFolders 

nowpath=path + "\" + objSubFolder.name

Response.Write nowpath

set objFiles=objSubFolder.Files

for each objFile in objFiles
Response.Write "<br>---"
Response.Write objFile.name
next
Response.Write "<p>"
bianli(nowpath)'
递归

next 
set objFolder=nothing
set objSubFolders=nothing
set fso=nothing
end function
%>
<%
'bianli("d:") '
遍历d:
%>

<%

'
替换指定文件内字符串的函数


function FSOlineedit(filename,Target,String)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FiletempData = objCountFile.ReadAll
objCountFile.Close
FiletempData=Replace(FiletempData,Target,String)
    Set objCountFile=objFSO.CreateTextFile(Server.MapPath(filename),True)
objCountFile.Write FiletempData 
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
End Function
response.write FSOlineedit("test.txt","
世界","明天是一个好天去")
%>
保持刷新文本框中的值
<HTML>
<HEAD>
<META NAME="save" CONTENT="history">
<STYLE>
   .saveHistory {behavior:url(#default#savehistory);}
</STYLE>
<title>
保持刷新文本框中的值</title></HEAD>
<BODY>
<INPUT class=saveHistory type=text id=oPersistInput>
</BODY>
</HTML>
ASP
中连接数据库的5种方法
ASP
中连接数据库的5种方法 
(01-3-30 199) 


from: chinaasp.com by caoli 


第一种 - 这种方法用在ACCESS中最多 

strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("aspfree.mdb") 

set conn = server.createobject("adodb.connection") 

conn.open strconn 

第二种-这种方法用在SQL SERVER中多 

strconn = "Driver={SQL 
Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;PWD=Password;DATABASE=Database_Name 

set conn = server.createobject("adodb.connection") 

conn.open strconn 

第三种 

strconn="Driver={MicrosoftAccessDriver(*.mdb)};" &_ 

"DBQ=F:\Inetpub\wwwroot\somedir\db1.mdb;DefaultDir=f:\Inetpub\wwwroot\somedir;uid=LoginID;" &_ 

"pwd=Password;DriverId=25;FIL=MSAccess;" set conn = server.createobject("adodb.connection") 

conn.open strconn 

第四种运用系统数据源 

The following uses a Data Source Name: 

set conn = server.createobject("adodb.connection") 

conn.open "Example" 

第五种运用ODBC数据源,前提是你必须在控制面板的ODBC中设置数据源 

set rs = server.createobject("adodb.recordset") 

rs.open "tblname", "DSNName", 3, 3 

汉字判断(js判断)
for(i=0;i<realname.length;i++){
  char=realname.charCodeAt(i);  
  if(!(char>255)){  
   alert("
真实姓名应为汉字!");
   userform.realname.focus();
   return false;
   }
  }

''
身份证真伪
''id 
省份证号
''birthday
生日,yyyy-mm-dd格式
''sex
性别,值为":1",":0"



id = "460102800925121"
birthday = "1980-09-25"
sex = 1 

IF idcard_check(id,birthday,sex) Then
   response.write "
不错"
else
   response.write "**"
End if

Function idcard_check(id,birthday,sex)
If len(id)<>15 and len(id)<>18 then
    idcard_check=false
    Exit Function
Else
    For i=1 to len(id)
       temp=mid(id,i,1)
       If temp<"0" or temp>"9" Then
           idcard_check=False
           Exit Function
       End if
    Next
    bdl=left(birthday,4) & mid(birthday,6,2) & mid(birthday,9,2)
    bds=mid(birthday,3,2) & mid(birthday,6,2) & mid(birthday,9,2)
    If len(id)=15 Then
        If mid(id,7,6)<>bds Then
            idcard_check=False
            Exit Function
        End if
        If int(mid(id,15,1)) Mod 2 = 1 And sex=1 Then
            idcard_check=True
            Exit Function
  ElseIf int(mid(id,15,1)) Mod 2 = 0 And sex=0 Then
            idcard_check=True
            Exit Function
  Else
      idcard_check=False
            Exit Function
        End if
    Else
        If mid(id,7,8)<>bdl Then
            idcard_check=False
            Exit Function
        End if
        If int(mid(id,17,1)) Mod 2 = 1 And sex=1 Then
            idcard_check=False
            Exit Function
  ElseIf int(mid(id,17,1)) Mod 2 = 0 And sex=0 Then
            idcard_check=False
            Exit Function
  Else
   idcard_check=False
            Exit Function
        End if
    End if
End if
idcard_check=True
End function
11="
北京"
12="
天津"
13="
河北"
14="
山西"
15="
内蒙古"
21="
辽宁"
22="
吉林"
23="
黑龙江"
31="
上海"
32="
江苏"
33="
浙江"
34="
安徽"
35="
福建"
36="
江西"
37="
山东"
41="
河南"
42="
湖北"
43="
湖南"
44="
广东"
45="
广西"
46="
海南"
50="
重庆"
51="
四川"
52="
贵州"
53="
云南"
54="
西藏"
61="
陕西"
62="
甘肃"
63="
青海"
64="
宁夏"
65="
新疆"
71="
台湾"
81="
香港"
82="
澳门"
91="
国外"

生成一个不重复的随即数字
Sub CalCaPiao()
Dim strCaiPiaoNoArr() As String
Dim strSQL As String
Dim strCaiPiaoNo As String
strCaiPiaoNo = "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33"
Dim StrTempArr(7) As String
Dim strZhongJiangArr(7) As String
strCaiPiaoNoArr = Split(strCaiPiaoNo, ",")
Dim intRand As Integer
Dim i As Integer
Dim j As Integer
i = 0
Dim find As Boolean
Do While True
find = False
Randomize
intRand = Int((33 * Rnd) + 1)
For j = 0 To i - 1
If StrTempArr(j) = CStr(intRand) Then
find = True
End If
Next
If Not find Then
StrTempArr(j) = CStr(intRand)
strZhongJiangArr(i) = CStr(intRand)
'Text1(i) = strZhongJiangArr(i)
i = i + 1
If i = 7 Then
Exit Do
End If
End If
Loop
End Sub


页面之间传递值方式1 ......
页面之间传递值方式1:  
页面之间传递值 
方式1: 
     
在接收页 的html代码里加上一行: 
<%@ Reference Page = "WebForm1.aspx" %>             
      
    WebForm1 fp=(WebForm1)Context.Handler; 
    this.TextBox1.Text=fp.name;   //name 是第一页的public变量 


Context  提供对整个当前上下文(包括请求对象)的访问。您可以使用此类共享页之间的信息。  

方式2:GET方式 
    在发送页 
      public int sum=0; 

           int i =int.Parse(this.TextBox1.Text)*2; 

           Server.Transfer("WebForm2.aspx?sum="+i); 

    接收页 
        this.TextBox1.Text=Request["sum"].ToString(); 
    or  this.TextBox1.Text=Request.Params["sum"].ToString(); 
        this.TextBox1.Text=Request.QueryString["sum"]; 


方法3:全局变量 

   发送页: 
       Application["sum"]=this.TextBox1.Text; 
       Server.Transfer("WebForm2.aspx"); 

   接收页: 
       this.TextBox1.Text=(string)Application["sum"]; 

Application实质上是整个虚拟目录中所有文件的集合,如果想在整个应用范围内使用某个变量值,Application对象将是最佳的选择 



方法4: 

 发送页: 
    1.定义静态变量:  public static string str="" 
    2. str=this.TextBox1.Text; 
       Server.Transfer("webform2.aspx"); 
 接收页: 
    1.引入第一页的命名空间:using WebApplication1; 
    2  this.TextBox1.Text=WebForm1.str; 


鼠标菜单制作 
<html> 
<head> 
</head> 
<body> 
<STYLE>.skin0  {  
BORDER-RIGHT
:  black  1px  solid;  BORDER-TOP:  black  1px  solid;  VISIBILITY:  hidden;  BORDER-LEFT:  black  1px  solid;  WIDTH:  150px;  CURSOR:  default;  LINE-HEIGHT:  1px;  BORDER-BOTTOM:  black  1px  solid;  FONT-FAMILY:  Verdana;  POSITION:  absolute;  BACKGROUND-COLOR:  black;  TEXT-ALIGN:  left  
}
  
.skin1  
{  
BORDER-RIGHT
:  buttonhighlight  0px  outset;  BORDER-TOP:  buttonhighlight  0px  outset;  FONT-SIZE:  9pt;  VISIBILITY:  hidden;  BORDER-LEFT:  buttonhighlight  0px  outset;  WIDTH:  120px;  CURSOR:  default;  BORDER-BOTTOM:  buttonhighlight  0px  outset;  FONT-FAMILY:  Arial,  Helvetica,  sans-serif;  POSITION:  absolute;  BACKGROUND-COLOR:  #000000;  TEXT-ALIGN:  center  
}
  
.menuitems  
{  
PADDING-RIGHT
:  10px;  PADDING-LEFT:  10px  
}
  
</STYLE>  
<SCRIPT  language=JavaScript>  

<!--  Begin  
var  menuskin  
=  "skin1"  //  skin0,  or  skin1  
var  display_url  
=  0;  //  Show  URLs  in  status  bar?  
function  showmenuie5()  {  
var  rightedge  
=  document.body.clientWidth-event.clientX;  
var  bottomedge  =  document.body.clientHeight-event.clientY;  
if  (rightedge  <  ie5menu.offsetWidth)  
ie5menu.style.left  
=  document.body.scrollLeft  +  event.clientX  -  ie5menu.offsetWidth;  
else  
ie5menu.style.left  
=  document.body.scrollLeft  +  event.clientX;  
if  (bottomedge  <  ie5menu.offsetHeight)  
ie5menu.style.top  
=  document.body.scrollTop  +  event.clientY  -  ie5menu.offsetHeight;  
else  
ie5menu.style.top  
=  document.body.scrollTop  +  event.clientY;  
ie5menu.style.visibility  
=  "visible"  
return  false;  
}  
function  hidemenuie5()  {  
ie5menu.style.visibility  
=  "hidden"  
}  
function  highlightie5()  {  
if  (event.srcElement.className  
==  "menuitems")  {  
event.srcElement.style.backgroundColor  
=  "highlight"  
event.srcElement.style.color  
=  "white"  
if  (display_url)  
window.status  
=  event.srcElement.url;  
      
}  
}  
function  lowlightie5()  {  
if  (event.srcElement.className  
==  "menuitems")  {  
event.srcElement.style.backgroundColor  
=  ""  
event.srcElement.style.color  
=  "black"  
window.status  
=  ""  
      }  
}  
function  jumptoie5()  {  
if  (event.srcElement.className  
==  "menuitems")  {  
if  (event.srcElement.getAttribute("target")  !
=  null)  
window.open(event.srcElement.url,  event.srcElement.getAttribute("target"));  
else  
window.location  
=  event.srcElement.url;  
      
}  
}  
//    End  --
>  
</SCRIPT>  

<DIV  class=skin0  id=ie5menu  onmouseover=highlightie5()    
style="LEFT:  280px;  TOP:  28px"  onclick=jumptoie5();  onmouseout=lowlightie5()>  
<DIV>  
<TABLE  height="97%"  cellSpacing=1  cellPadding=0  width="98%"  align=center    
bgColor=#000000>  
    
<TBODY>  
    
<TR>  
        
<a  href="http://www.dqhc.com"  target=_blank><TD    
        
onmouseover="this.style.backgroundColor=''#999900'';  this.style.cursor=''hand'';"    
        onmouseout
="this.style.backgroundColor=''#99cc33'';"  bgColor=#99cc00  height=20    
        
scroll="no"  onload="window.defaultStatus=''00009876.4567.net'';">  
          
            
<CENTER><BR>华创公司<br><br></CENTER></TD></a></TR>  
    
<TR>  
        
<a  href="http://www.sina.com.cn"  target=_blank><TD    
        
onmouseover="this.style.backgroundColor=''#ff9900'';  this.style.cursor=''hand'';"    
        onmouseout
="this.style.backgroundColor=''#ffcc00'';"  bgColor=#ffcc00    
height=20>  
            
<CENTER><br>  
            新浪首页 
              
<br><br></CENTER></TD></a></TR>  
    
<TR>  
        
<A  href="http://www.sohu.com"  target=_blank><TD    
        
onmouseover="this.style.backgroundColor=''#ff6633'';  this.style.cursor=''hand'';"    
        onmouseout
="this.style.backgroundColor=''#ff9900'';"  vAlign=center    
        
bgColor=#ff9900>  
            
<br><CENTER>搜狐首页 <br><br>  
            
</CENTER></TD></A></TR>  
    
      
<TR><A   
            
href="http://www.163.com">  
        
<TD    
        
onmouseover="this.style.backgroundColor=''#ff9900'';  this.style.cursor=''hand'';"    
        onmouseout
="this.style.backgroundColor=''#ffcc00'';"  vAlign=center    
        
bgColor=#ffcc00>  
            
<br><CENTER>网易首页</CENTER><br></TD></A></TR>  
    
</TBODY></TABLE></DIV></DIV>  
<SCRIPT  language=JavaScript>  
if  (document.all  &&  window.print)  {  
ie5menu.className  
=  menuskin;  
document.oncontextmenu  =  showmenuie5;  
document.body.onclick  =  hidemenuie5;  
}  
</SCRIPT
>  
</body> 
</html>