精华网页代码

精华网页代码1.oncontextmenu=”window.event.returnvalue=false”将彻底屏蔽鼠标右键<tableborderoncontextmenu=return(false)><td>no</table>可用于Table2.<bodyonselectstart=”returnfalse…

大家好,又见面了,我是你们的朋友全栈君。

1.  οncοntextmenu=”window.event.returnvalue=false”      将彻底屏蔽鼠标右键 
    <table border οncοntextmenu=return(false)><td>no</table>   可用于Table 

2.  <body onselectstart=”return false”>                 取消选取、防止复制 

3.  οnpaste=”return false”                                        不准粘贴 

4.  οncοpy=”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=查看网页源代码  
οnclick=”window.location = ‘view-source:’+ ‘http://www.csdn.net/&#39;”> 

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″ οnfοcus=”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=最小化 οnclick=hh1.Click()> 
<input type=button value=最大化 οnclick=hh2.Click()> 
<input type=button value=关闭 οnclick=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 = a.valueOf() 
a = a – dadd * 24 * 60 * 60 * 1000 
a = 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” οnclick=”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 οnkeydοwn=”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 οnclick=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 οnerrοr=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 οnlοad=”openwin()”>
..任意的页面内容…
</body>
</html>

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

 方法一:<body οnlοad=”openwin()”> 浏览器读页面时弹出窗口;
 方法二:<body οnunlοad=”openwin()”> 浏览器离开页面时弹出窗口;
 方法三:用一个连接调用:
<a href=”注意:使用的“ 方法四:用一个按钮调用:
<input type=”button” οnclick=”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>区:
<a href=”1.htm” οnclick=”openwin()”>open</a>即可。

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

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

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

function closeit() {

setTimeout(“self.close()”,10000) //毫秒

}

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

 写到这里弹出窗口的制作和应用技巧基本上算是完成了,俺也累坏了,一口气说了这么多,希望对正在制作网页的朋友有所帮助俺就非常欣慰了。
 需要注意的是,JS脚本中的的大小写最好前后保持一致。

 
 
 
回复:4color
 Email 2003-10-23 23:16:58 
 
06.打开窗口即最大化
<script language=”javascript”>
<!– Begin
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
// End –>
</script>
 
 
回复:4color
 Email 2003-10-23 23:17:15 
 
12.细线分隔线

<hr noshade size=0 color=#C0C0C0>
 
 
 
回复:4color
 Email 2003-10-23 23:17:34 
 
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=# οnclick=this.style.behavior=’url(#default#homepage)’;this.setHomePage(‘http://链接’);〉设为首页〈/a〉

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

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

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

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

 
 
 
根据内容扩大IFRAME的高度
 
<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> 
 
 
自动计算数值

 
单价:20<br>
数量:<input type=text onKeyUp=”javascript:total.value=20*this.value;”><br>
金额:<input type=text name=total><br> 
 
 
JS:弹出式窗口自动适应图片大小的代码!

 
<script>
str1=window.open(‘javascript:document.write(“<body style=margin:0><img src=http://192.168.0.44/images/logo.gif>”);window.resizeTo(document.images(0).width,document.images(0).height+20)’,”win1″,”toolbar=0″)
</script> 
 
 
排序表格(来自WebFx Activex)

 
<html>
<head>
<title>排序列表</title>
<script language = “javascript”>

function SortableTable(oTable, oSortTypes) {

this.element = oTable;
this.tHead = oTable.tHead;
this.tBody = oTable.tBodies[0];
this.document = oTable.ownerDocument || oTable.document;

this.sortColumn = null;
this.descending = null;

var oThis = this;
this._headeronclick = function (e) {

oThis.headeronclick(e);
};

// only IE needs this
var win = this.document.defaultView || this.document.parentWindow;
this._onunload = function () {

oThis.destroy();
};
if (win && typeof win.attachEvent != “undefined”) {

win.attachEvent(“onunload”, this._onunload);
}

this.initHeader(oSortTypes || []);
}

SortableTable.gecko = navigator.product == “Gecko”;
SortableTable.msie = /msie/i.test(navigator.userAgent);
// Mozilla is faster when doing the DOM manipulations on
// an orphaned element. MSIE is not
SortableTable.removeBeforeSort = SortableTable.gecko;

SortableTable.prototype.onsort = function () {};

// adds arrow containers and events
// also binds sort type to the header cells so that reordering columns does
// not break the sort types
SortableTable.prototype.initHeader = function (oSortTypes) {

var cells = this.tHead.rows[0].cells;
var l = cells.length;
var img, c;
for (var i = 0; i < l; i++) {

c = cells[i];
img = this.document.createElement(“IMG”);
img.src = “images/blank.png”;
c.appendChild(img);
if (oSortTypes[i] != null) {

c._sortType = oSortTypes[i];
}
if (typeof c.addEventListener != “undefined”)
c.addEventListener(“click”, this._headeronclick, false);
else if (typeof c.attachEvent != “undefined”)
c.attachEvent(“onclick”, this._headeronclick);
}
this.updateHeaderArrows();
};

// remove arrows and events
SortableTable.prototype.uninitHeader = function () {

var cells = this.tHead.rows[0].cells;
var l = cells.length;
var c;
for (var i = 0; i < l; i++) {

c = cells[i];
c.removeChild(c.lastChild);
if (typeof c.removeEventListener != “undefined”)
c.removeEventListener(“click”, this._headeronclick, false);
else if (typeof c.detachEvent != “undefined”)
c.detachEvent(“onclick”, this._headeronclick);
}
};

SortableTable.prototype.updateHeaderArrows = function () {

var cells = this.tHead.rows[0].cells;
var l = cells.length;
var img;
for (var i = 0; i < l; i++) {

img = cells[i].lastChild;
if (i == this.sortColumn)
img.className = “sort-arrow ” + (this.descending ? “descending” : “ascending”);
else
img.className = “sort-arrow”;
}
};

SortableTable.prototype.headeronclick = function (e) {

// find TD element
var el = e.target || e.srcElement;
while (el.tagName != “TD”)
el = el.parentNode;

this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);
};

// IE returns wrong cellIndex when columns are hidden
SortableTable.getCellIndex = function (oTd) {

var cells = oTd.parentNode.childNodes
var l = cells.length;
var i;
for (i = 0; cells[i] != oTd && i < l; i++)
;
return i;
};

SortableTable.prototype.getSortType = function (nColumn) {

var cell = this.tHead.rows[0].cells[nColumn];
var val = cell._sortType;
if (val != “”)
return val;
return “String”;
};

// only nColumn is required
// if bDescending is left out the old value is taken into account
// if sSortType is left out the sort type is found from the sortTypes array

SortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {

if (sSortType == null)
sSortType = this.getSortType(nColumn);

// exit if None
if (sSortType == “None”)
return;

if (bDescending == null) {

if (this.sortColumn != nColumn)
this.descending = true;
else
this.descending = !this.descending;
}

this.sortColumn = nColumn;

if (typeof this.onbeforesort == “function”)
this.onbeforesort();

var f = this.getSortFunction(sSortType, nColumn);
var a = this.getCache(sSortType, nColumn);
var tBody = this.tBody;

a.sort(f);

if (this.descending)
a.reverse();

if (SortableTable.removeBeforeSort) {

// remove from doc
var nextSibling = tBody.nextSibling;
var p = tBody.parentNode;
p.removeChild(tBody);
}

// insert in the new order
var l = a.length;
for (var i = 0; i < l; i++)
tBody.appendChild(a[i].element);

if (SortableTable.removeBeforeSort) {

// insert into doc
p.insertBefore(tBody, nextSibling);
}

this.updateHeaderArrows();

this.destroyCache(a);

if (typeof this.onsort == “function”)
this.onsort();
};

SortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {

var oThis = this;
this._asyncsort = function () {

oThis.sort(nColumn, bDescending, sSortType);
};
window.setTimeout(this._asyncsort, 1);
};

SortableTable.prototype.getCache = function (sType, nColumn) {

var rows = this.tBody.rows;
var l = rows.length;
var a = new Array(l);
var r;
for (var i = 0; i < l; i++) {

r = rows[i];
a[i] = {

value: this.getRowvalue(r, sType, nColumn),
element: r
};
};
return a;
};

SortableTable.prototype.destroyCache = function (oArray) {

var l = oArray.length;
for (var i = 0; i < l; i++) {

oArray[i].value = null;
oArray[i].element = null;
oArray[i] = null;
}
}

SortableTable.prototype.getRowvalue = function (oRow, sType, nColumn) {

var s;
var c = oRow.cells[nColumn];
if (typeof c.innerText != “undefined”)
s = c.innerText;
else
s = SortableTable.getInnerText(c);
return this.getvalueFromString(s, sType);
};

SortableTable.getInnerText = function (oNode) {

var s = “”;
var cs = oNode.childNodes;
var l = cs.length;
for (var i = 0; i < l; i++) {

switch (cs[i].nodeType) {

case 1: //ELEMENT_NODE
s += SortableTable.getInnerText(cs[i]);
break;
case 3: //TEXT_NODE
s += cs[i].nodevalue;
break;
}
}
return s;
}

SortableTable.prototype.getvalueFromString = function (sText, sType) {

switch (sType) {

case “Number”:
return Number(sText);
case “CaseInsensitiveString”:
return sText.toUpperCase();
case “Date”:
var parts = sText.split(“-“);
var d = new Date(0);
d.setFullYear(parts[0]);
d.setDate(parts[2]);
d.setMonth(parts[1] – 1);
return d.valueOf();
}
return sText;
};

SortableTable.prototype.getSortFunction = function (sType, nColumn) {

return function compare(n1, n2) {

if (n1.value < n2.value)
return -1;
if (n2.value < n1.value)
return 1;
return 0;
};
};

SortableTable.prototype.destroy = function () {

this.uninitHeader();
var win = this.document.parentWindow;
if (win && typeof win.detachEvent != “undefined”) { // only IE needs this
win.detachEvent(“onunload”, this._onunload);
}
this._onunload = null;
this.element = null;
this.tHead = null;
this.tBody = null;
this.document = null;
this._headeronclick = null;
this.sortTypes = null;
this._asyncsort = null;
this.onsort = null;
};
</script>
<style type=”text/css”>
.sort-table {

font: Icon;
border: 1px Solid ThreeDShadow;
background: Window;
color: WindowText;
}

.sort-table thead {

background: ButtonFace;
}

.sort-table td {

padding: 2px 5px;
}

.sort-table thead td {

border: 1px solid;
border-color: ButtonHighlight ButtonShadow
ButtonShadow ButtonHighlight;
cursor: default;
}

.sort-table thead td:active {

border-color: ButtonShadow ButtonHighlight
ButtonHighlight ButtonShadow;
padding: 3px 4px 1px 6px;
}

.sort-arrow {

width: 11px;
height: 11px;
background-position: center center;
background-repeat: no-repeat;
margin: 0 2px;
}

.sort-arrow.descending {

background-image: url(“
http://www.lshdic.com/images/downsimple.png“;);

}

.sort-arrow.ascending {

background-image: url(“
http://www.lshdic.com/images/upsimple.png“;);
}
body {

font-family: Verdana, Helvetica, Arial, Sans-Serif;
font: Message-Box;
}

code {

font-size: 1em;
}

</style>
</head>
<body>
点击表头排序

<center><h1>排序表格</h1></center>
<table border = ‘1’ class=”sort-table” id=”table-1″ cellspacing=”0″ width = ‘100%’>
<col />
<col />
<col style=”text-align: right” />
<col />
<thead>
<tr align = “center”>
<td>选择</td>
<td>字符串</td>
<td title=”CaseInsensitiveString”>字符串</td>
<td>数字</td>
<td>日期</td>
</tr>
</thead>
<tbody>
<tr>
<td><input type = “checkbox”></td>
<td><a href = “www”>apple</a></td>
<td>Strawberry</td>
<td>45</td>
<td>2001-03-13</td>
</tr>
<tr>
<td><input type = “checkbox”></td>
<td>Banana</td>
<td>orange</td>
<td></td>
<td>1789-07-14</td>
</tr>
<tr>
<td><input type = “checkbox”></td>
<td>orange</td>
<td>Banana</td>
<td>4546</td>
<td>1949-07-04</td>
</tr>
<tr>
<td><input type = “checkbox”></td>
<td>Strawberry</td>
<td>apple</td>
<td>987</td>
<td>1975-08-19</td>
</tr>
<tr>
<td><input type = “checkbox”></td>
<td>Pear</td>
<td>blueberry</td>
<td>98743</td>
<td>2001-01-01</td>
</tr>
<tr>
<td><input type = “checkbox”></td>
<td>blueberry</td>
<td>Pear</td>
<td>4</td>
<td>2001-04-18</td>
</tr>
</tbody>
</table>

<script type=”text/javascript”>

var st1 = new SortableTable(document.getElementById(“table-1”),
[“None”, “String”, “CaseInsensitiveString”, “Number”, “Date”, “None”]);

  </script>
</body>
</html>

 
 
 
如何把选定的文本内容复制到剪贴板!
 
<Script Language=Jscript>
alert(clipboardData.getData(‘text’))  //取得当前的剪切版内容
window.clipboardData.setData(‘text’,’指定数据’) //自定义剪切版中的内容
alert(clipboardData.getData(‘text’)) //在次取得当前剪切版内容
</Script> 
 
 
判断radio多个单选按纽中是否有被选中的按纽

 
<!–风云突变原做–>

<script language=”javascript”>
<!–
function test() {

for (i=0;i<document.all(‘test’).length;i++) {

if (document.all(‘test’)[i].checked) {alert (‘有选’);return false;}
}
alert (‘没选’);
return false;
}
//–>
</script>
<input type=”radio” name=”test”>
<input type=”radio” name=”test”>
<input type=”radio” name=”test”>
<input type=”radio” name=”test”>
<input type=”radio” name=”test”>
<input type=”button” value=”test” onClick=”test()”>

 
 
 
关于Cursor属性提供的各种鼠标形状

 
<center>应用时只需<TD style=’cursor:表格所列出的字母;’>即可,当然TD可以是其他HTML标签</center><p>
<table cellSpacing=”1″ cellPadding=”0″ width=”280″ bgColor=”#fefafa” border=”0″ align=center>
<tr>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: crosshair; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  crosshair</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: default; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  default</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: hand; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  hand</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: pointer; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#ffc080″>
  pointer</td>
</tr>
<tr>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: move; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  move</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: help; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  help</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: wait; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  wait</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: text; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  text</td>
</tr>
<tr>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: w-resize; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  w-resize</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: s-resize; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  s-resize</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: n-resize; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  n-resize</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: e-resize; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  e-resize</td>
</tr>
<tr>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: ne-resize; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  ne-resize</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: sw-resize; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  sw-resize</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: se-resize; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  se-resize</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: nw-resize; PADDING-TOP: 5px” align=”center”” width=”25%” bgColor=”#cccfff”>
  nw-resize</td>
</tr>
<tr>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: auto; PADDING-TOP: 5px” align=”middle” width=”25%” bgColor=”#cccfff”>
  auto</td>
  <td style=”PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; CURSOR: url(‘http://www.lshdic.com/img/mouse2.cur&#39;); PADDING-TOP: 5px” align=”middle” width=”75%” bgColor=”#ffc080″ colSpan=”3″>
  url(
http://www.lshdic.com/img/mouse2.cur)</td>
</tr>
</table>  
 
 
Html:绝对与浏览器边框无缝隙的网页效果

 
<body bgcolor=menu style=”border:none” scroll=no>  
 
 
Dhtml:制作的一个完美仿真的window选项卡

 
<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&#39; 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 οnlοad=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修改文件特定内容的函数
 
 
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:盘
%>
替换指定文件内字符串的函数
 Email 2003-10-31 14:19:59 
 

<%

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

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”,”世界”,”明天是一个好天去”)
%>
 
 
回复:保持刷新文本框中的值
 Email 2003-10-31 14:20:37 
 
<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种方法

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判断)
 
//=====================js判断====================
//这样更简单
for(i=0;i<realname.length;i++){

  char=realname.charCodeAt(i); 
  if(!(char>255)){ 
   alert(“真实姓名应为汉字!”);
   userform.realname.focus();
   return false;
   }
  }


 
 
 
汉字判断
function isChinese(para)
       on error resume next
       dim str
       dim i
       if isNUll(para) then
          isChinese=false
          exit function
       end if
       str=cstr(para)
       if trim(str)=”” then
          isChinese=false
          exit function
       end if
       for i=1 to len(str)
     c=asc(mid(str,i,1))
             if c>=0 then
    isChinese=false
              exit function
           end if
       next
       isChinese=true
       if err.number<>0 then err.clear
   end function

‘如:
‘if not isChinese(request(“name”)) then
‘ errmsg=errmsg+”
‘”+”<li>用户名应为汉字”
‘ founderr=true
‘else
‘ username=trim(request(“name”))
‘end if
%>

 
 
 

 
原理,使用Dictionary技术
1.添加索引
2.遍历词典

<%
Set d = CreateObject(“Scripting.Dictionary”)
d.add “a”,-20319
d.add “ai”,-20317
d.add “an”,-20304
d.add “ang”,-20295
d.add “ao”,-20292
d.add “ba”,-20283
d.add “bai”,-20265
d.add “ban”,-20257
d.add “bang”,-20242
d.add “bao”,-20230
d.add “bei”,-20051
d.add “ben”,-20036
d.add “beng”,-20032
d.add “bi”,-20026
d.add “bian”,-20002
d.add “biao”,-19990
d.add “bie”,-19986
d.add “bin”,-19982
d.add “bing”,-19976
d.add “bo”,-19805
d.add “bu”,-19784
d.add “ca”,-19775
d.add “cai”,-19774
d.add “can”,-19763
d.add “cang”,-19756
d.add “cao”,-19751
d.add “ce”,-19746
d.add “ceng”,-19741
d.add “cha”,-19739
d.add “chai”,-19728
d.add “chan”,-19725
d.add “chang”,-19715
d.add “chao”,-19540
d.add “che”,-19531
d.add “chen”,-19525
d.add “cheng”,-19515
d.add “chi”,-19500
d.add “chong”,-19484
d.add “chou”,-19479
d.add “chu”,-19467
d.add “chuai”,-19289
d.add “chuan”,-19288
d.add “chuang”,-19281
d.add “chui”,-19275
d.add “chun”,-19270
d.add “chuo”,-19263
d.add “ci”,-19261
d.add “cong”,-19249
d.add “cou”,-19243
d.add “cu”,-19242
d.add “cuan”,-19238
d.add “cui”,-19235
d.add “cun”,-19227
d.add “cuo”,-19224
d.add “da”,-19218
d.add “dai”,-19212
d.add “dan”,-19038
d.add “dang”,-19023
d.add “dao”,-19018
d.add “de”,-19006
d.add “deng”,-19003
d.add “di”,-18996
d.add “dian”,-18977
d.add “diao”,-18961
d.add “die”,-18952
d.add “ding”,-18783
d.add “diu”,-18774
d.add “dong”,-18773
d.add “dou”,-18763
d.add “du”,-18756
d.add “duan”,-18741
d.add “dui”,-18735
d.add “dun”,-18731
d.add “duo”,-18722
d.add “e”,-18710
d.add “en”,-18697
d.add “er”,-18696
d.add “fa”,-18526
d.add “fan”,-18518
d.add “fang”,-18501
d.add “fei”,-18490
d.add “fen”,-18478
d.add “feng”,-18463
d.add “fo”,-18448
d.add “fou”,-18447
d.add “fu”,-18446
d.add “ga”,-18239
d.add “gai”,-18237
d.add “gan”,-18231
d.add “gang”,-18220
d.add “gao”,-18211
d.add “ge”,-18201
d.add “gei”,-18184
d.add “gen”,-18183
d.add “geng”,-18181
d.add “gong”,-18012
d.add “gou”,-17997
d.add “gu”,-17988
d.add “gua”,-17970
d.add “guai”,-17964
d.add “guan”,-17961
d.add “guang”,-17950
d.add “gui”,-17947
d.add “gun”,-17931
d.add “guo”,-17928
d.add “ha”,-17922
d.add “hai”,-17759
d.add “han”,-17752
d.add “hang”,-17733
d.add “hao”,-17730
d.add “he”,-17721
d.add “hei”,-17703
d.add “hen”,-17701
d.add “heng”,-17697
d.add “hong”,-17692
d.add “hou”,-17683
d.add “hu”,-17676
d.add “hua”,-17496
d.add “huai”,-17487
d.add “huan”,-17482
d.add “huang”,-17468
d.add “hui”,-17454
d.add “hun”,-17433
d.add “huo”,-17427
d.add “ji”,-17417
d.add “jia”,-17202
d.add “jian”,-17185
d.add “jiang”,-16983
d.add “jiao”,-16970
d.add “jie”,-16942
d.add “jin”,-16915
d.add “jing”,-16733
d.add “jiong”,-16708
d.add “jiu”,-16706
d.add “ju”,-16689
d.add “juan”,-16664
d.add “jue”,-16657
d.add “jun”,-16647
d.add “ka”,-16474
d.add “kai”,-16470
d.add “kan”,-16465
d.add “kang”,-16459
d.add “kao”,-16452
d.add “ke”,-16448
d.add “ken”,-16433
d.add “keng”,-16429
d.add “kong”,-16427
d.add “kou”,-16423
d.add “ku”,-16419
d.add “kua”,-16412
d.add “kuai”,-16407
d.add “kuan”,-16403
d.add “kuang”,-16401
d.add “kui”,-16393
d.add “kun”,-16220
d.add “kuo”,-16216
d.add “la”,-16212
d.add “lai”,-16205
d.add “lan”,-16202
d.add “lang”,-16187
d.add “lao”,-16180
d.add “le”,-16171
d.add “lei”,-16169
d.add “leng”,-16158
d.add “li”,-16155
d.add “lia”,-15959
d.add “lian”,-15958
d.add “liang”,-15944
d.add “liao”,-15933
d.add “lie”,-15920
d.add “lin”,-15915
d.add “ling”,-15903
d.add “liu”,-15889
d.add “long”,-15878
d.add “lou”,-15707
d.add “lu”,-15701
d.add “lv”,-15681
d.add “luan”,-15667
d.add “lue”,-15661
d.add “lun”,-15659
d.add “luo”,-15652
d.add “ma”,-15640
d.add “mai”,-15631
d.add “man”,-15625
d.add “mang”,-15454
d.add “mao”,-15448
d.add “me”,-15436
d.add “mei”,-15435
d.add “men”,-15419
d.add “meng”,-15416
d.add “mi”,-15408
d.add “mian”,-15394
d.add “miao”,-15385
d.add “mie”,-15377
d.add “min”,-15375
d.add “ming”,-15369
d.add “miu”,-15363
d.add “mo”,-15362
d.add “mou”,-15183
d.add “mu”,-15180
d.add “na”,-15165
d.add “nai”,-15158
d.add “nan”,-15153
d.add “nang”,-15150
d.add “nao”,-15149
d.add “ne”,-15144
d.add “nei”,-15143
d.add “nen”,-15141
d.add “neng”,-15140
d.add “ni”,-15139
d.add “nian”,-15128
d.add “niang”,-15121
d.add “niao”,-15119
d.add “nie”,-15117
d.add “nin”,-15110
d.add “ning”,-15109
d.add “niu”,-14941
d.add “nong”,-14937
d.add “nu”,-14933
d.add “nv”,-14930
d.add “nuan”,-14929
d.add “nue”,-14928
d.add “nuo”,-14926
d.add “o”,-14922
d.add “ou”,-14921
d.add “pa”,-14914
d.add “pai”,-14908
d.add “pan”,-14902
d.add “pang”,-14894
d.add “pao”,-14889
d.add “pei”,-14882
d.add “pen”,-14873
d.add “peng”,-14871
d.add “pi”,-14857
d.add “pian”,-14678
d.add “piao”,-14674
d.add “pie”,-14670
d.add “pin”,-14668
d.add “ping”,-14663
d.add “po”,-14654
d.add “pu”,-14645
d.add “qi”,-14630
d.add “qia”,-14594
d.add “qian”,-14429
d.add “qiang”,-14407
d.add “qiao”,-14399
d.add “qie”,-14384
d.add “qin”,-14379
d.add “qing”,-14368
d.add “qiong”,-14355
d.add “qiu”,-14353
d.add “qu”,-14345
d.add “quan”,-14170
d.add “que”,-14159
d.add “qun”,-14151
d.add “ran”,-14149
d.add “rang”,-14145
d.add “rao”,-14140
d.add “re”,-14137
d.add “ren”,-14135
d.add “reng”,-14125
d.add “ri”,-14123
d.add “rong”,-14122
d.add “rou”,-14112
d.add “ru”,-14109
d.add “ruan”,-14099
d.add “rui”,-14097
d.add “run”,-14094
d.add “ruo”,-14092
d.add “sa”,-14090
d.add “sai”,-14087
d.add “san”,-14083
d.add “sang”,-13917
d.add “sao”,-13914
d.add “se”,-13910
d.add “sen”,-13907
d.add “seng”,-13906
d.add “sha”,-13905
d.add “shai”,-13896
d.add “shan”,-13894
d.add “shang”,-13878
d.add “shao”,-13870
d.add “she”,-13859
d.add “shen”,-13847
d.add “sheng”,-13831
d.add “shi”,-13658
d.add “shou”,-13611
d.add “shu”,-13601
d.add “shua”,-13406
d.add “shuai”,-13404
d.add “shuan”,-13400
d.add “shuang”,-13398
d.add “shui”,-13395
d.add “shun”,-13391
d.add “shuo”,-13387
d.add “si”,-13383
d.add “song”,-13367
d.add “sou”,-13359
d.add “su”,-13356
d.add “suan”,-13343
d.add “sui”,-13340
d.add “sun”,-13329
d.add “suo”,-13326
d.add “ta”,-13318
d.add “tai”,-13147
d.add “tan”,-13138
d.add “tang”,-13120
d.add “tao”,-13107
d.add “te”,-13096
d.add “teng”,-13095
d.add “ti”,-13091
d.add “tian”,-13076
d.add “tiao”,-13068
d.add “tie”,-13063
d.add “ting”,-13060
d.add “tong”,-12888
d.add “tou”,-12875
d.add “tu”,-12871
d.add “tuan”,-12860
d.add “tui”,-12858
d.add “tun”,-12852
d.add “tuo”,-12849
d.add “wa”,-12838
d.add “wai”,-12831
d.add “wan”,-12829
d.add “wang”,-12812
d.add “wei”,-12802
d.add “wen”,-12607
d.add “weng”,-12597
d.add “wo”,-12594
d.add “wu”,-12585
d.add “xi”,-12556
d.add “xia”,-12359
d.add “xian”,-12346
d.add “xiang”,-12320
d.add “xiao”,-12300
d.add “xie”,-12120
d.add “xin”,-12099
d.add “xing”,-12089
d.add “xiong”,-12074
d.add “xiu”,-12067
d.add “xu”,-12058
d.add “xuan”,-12039
d.add “xue”,-11867
d.add “xun”,-11861
d.add “ya”,-11847
d.add “yan”,-11831
d.add “yang”,-11798
d.add “yao”,-11781
d.add “ye”,-11604
d.add “yi”,-11589
d.add “yin”,-11536
d.add “ying”,-11358
d.add “yo”,-11340
d.add “yong”,-11339
d.add “you”,-11324
d.add “yu”,-11303
d.add “yuan”,-11097
d.add “yue”,-11077
d.add “yun”,-11067
d.add “za”,-11055
d.add “zai”,-11052
d.add “zan”,-11045
d.add “zang”,-11041
d.add “zao”,-11038
d.add “ze”,-11024
d.add “zei”,-11020
d.add “zen”,-11019
d.add “zeng”,-11018
d.add “zha”,-11014
d.add “zhai”,-10838
d.add “zhan”,-10832
d.add “zhang”,-10815
d.add “zhao”,-10800
d.add “zhe”,-10790
d.add “zhen”,-10780
d.add “zheng”,-10764
d.add “zhi”,-10587
d.add “zhong”,-10544
d.add “zhou”,-10533
d.add “zhu”,-10519
d.add “zhua”,-10331
d.add “zhuai”,-10329
d.add “zhuan”,-10328
d.add “zhuang”,-10322
d.add “zhui”,-10315
d.add “zhun”,-10309
d.add “zhuo”,-10307
d.add “zi”,-10296
d.add “zong”,-10281
d.add “zou”,-10274
d.add “zu”,-10270
d.add “zuan”,-10262
d.add “zui”,-10260
d.add “zun”,-10256
d.add “zuo”,-10254

function g(num)
if num>0 and num<160 then
g=chr(num)
else
if num<-20319 or num>-10247 then
g=””
else
a=d.Items
b=d.keys
for i=d.count-1 to 0 step -1
if a(i)<=num then exit for
next
g=b(i)
end if
end if
end function
function c(str)
c=””
for i=1 to len(str)
c=c&g(asc(mid(str,i,1)))
next
end function
response.write c(request(“hz”))
%>
<form method=post>
请在此处输入中文:<input name=hz> 
 
 
货币大写转换函数的更新

 
<%
dim a ‘要转换成大写的金额
dim atoc ‘转换之后的值
Dim String1 ‘如下定义
Dim String2 ‘如下定义
Dim String3 ‘从原A值中取出的值
Dim I ‘循环变量
Dim J ‘A的值乘以100的字符串长度
Dim Ch1 ‘数字的汉语读法
Dim Ch2 ‘数字位的汉字读法
Dim nZero ‘用来计算连续的零值是几个

String1 = “零壹贰叁肆伍陆柒捌玖”
String2 = “万仟佰拾亿仟佰拾万仟佰拾元角分”
nZero = 0

If InStr(1, CStr(a * 100), “.”) <> 0 Then
err.Raise 5000, , “此函数( AtoC() )只能转换小数点后有两位以内的数!”
End If

J = Len(CStr(a * 100))
String2 = Right(String2, J) ‘取出对应位数的STRING2的值

For I = 1 To J
String3 = Mid(a * 100, I, 1) ‘取出需转换的某一位的值

If I <> (J – 3) + 1 And I <> (J – 7) + 1 And I <> (J – 11) + 1 And I <>(J – 15) + 1 Then
If String3 = 0 Then
Ch1 = “”
Ch2 = “”
nZero = nZero + 1
ElseIf String3 <> 0 And nZero <> 0 Then
Ch1 = “零” & Mid(String1, clng(String3) + 1, 1)
Ch2 = Mid(String2, I, 1)
nZero = 0
Else
Ch1 = Mid(String1, clng(String3) + 1, 1)
Ch2 = Mid(String2, I, 1)
nZero = 0
End If
Else ‘该位是万亿,亿,万,元位等关键位
If String3 <> 0 And nZero <> 0 Then
Ch1 = “零” & Mid(String1, clng(String3) + 1, 1)
Ch2 = Mid(String2, I, 1)
nZero = 0
ElseIf String3 <> 0 And nZero = 0 Then
Ch1 = Mid(String1, clng(String3) + 1, 1)
Ch2 = Mid(String2, I, 1)
nZero = 0
ElseIf String3 = 0 And nZero >= 3 Then
Ch1 = “”
Ch2 = “”
nZero = nZero + 1
Else
Ch1 = “”
Ch2 = Mid(String2, I, 1)
nZero = nZero + 1
End If

If I = (J – 11) + 1 Or I = (J – 3) + 1 Then ‘如果该位是亿位或元位,则必须写上
Ch2 = Mid(String2, I, 1)
End If

End If
AtoC = AtoC & Ch1 & Ch2

If I = J And String3 = 0 Then ‘最后一位(分)为0时,加上“整”
AtoC = AtoC & “整”
End If

Next
if a=0 then
atoc=”零元整”
end if
%> 
 
 
 

<%

获取中文字符串拼音首字母串的函数

response.write “<link href=style.css _fcksavedurl=”style.css” rel=stylesheet>”
if request.form(“content”)=”” then
response.write “<center><form method=post action=asd.asp><input name=content type=text>__<input type=submit></form>”
else
function getpychar(char)
tmp=65536+asc(char)
if(tmp>=45217 and tmp<=45252) then
getpychar= “A”
elseif(tmp>=45253 and tmp<=45760) then
getpychar= “B”
elseif(tmp>=45761 and tmp<=46317) then
getpychar= “C”
elseif(tmp>=46318 and tmp<=46825) then
getpychar= “D”
elseif(tmp>=46826 and tmp<=47009) then
getpychar= “E”
elseif(tmp>=47010 and tmp<=47296) then
getpychar= “F”
elseif(tmp>=47297 and tmp<=47613) then
getpychar= “G”
elseif(tmp>=47614 and tmp<=48118) then
getpychar= “H”
elseif(tmp>=48119 and tmp<=49061) then
getpychar= “J”
elseif(tmp>=49062 and tmp<=49323) then
getpychar= “K”
elseif(tmp>=49324 and tmp<=49895) then
getpychar= “L”
elseif(tmp>=49896 and tmp<=50370) then
getpychar= “M”
elseif(tmp>=50371 and tmp<=50613) then
getpychar= “N”
elseif(tmp>=50614 and tmp<=50621) then
getpychar= “O”
elseif(tmp>=50622 and tmp<=50905) then
getpychar= “P”
elseif(tmp>=50906 and tmp<=51386) then
getpychar= “Q”
elseif(tmp>=51387 and tmp<=51445) then
getpychar= “R”
elseif(tmp>=51446 and tmp<=52217) then
getpychar= “S”
elseif(tmp>=52218 and tmp<=52697) then
getpychar= “T”
elseif(tmp>=52698 and tmp<=52979) then
getpychar= “W”
elseif(tmp>=52980 and tmp<=53640) then
getpychar= “X”
elseif(tmp>=53689 and tmp<=54480) then
getpychar= “Y”
elseif(tmp>=54481 and tmp<=62289) then
getpychar= “Z”
else ‘如果不是中文,则不处理
getpychar=char
end if
end function
function getpy(str)
for i=1 to len(str)
getpy=getpy&getpychar(mid(str,i,1))
next
end function
content=request.form(“content”)
response.write “<center>”&getpy(content)&chr(10)
response.write “<br><br><br><a href=# οnclick=javascript:history.go(-1)>返回</a>”
end if
%>

 
 
 

 
检查字符串是否包含非法字符串
FUNCTION BadWords(strContent)
DIM objRegExp
Set objRegExp = new RegExp
objRegExp.IgnoreCase = true
objRegExp.Global = true
objRegExp.Pattern = “李.{0,10}洪.{0,10}志|法.{0,10}轮.{0,10}功|法.{0,10}轮.{0,10}大.{0,10}法|明.{0,10}慧.{0,10}网|六.{0,10}四.{0,10}真.{0,10}相|修炼.{0,10}大法”
BadWords = objRegExp.Test(strContent)
Set objRegExp = Nothing
END FUNCTION 
 
 
身份证真伪

 
”身份证真伪
”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

 
 
 
显示左边的n个字符(自动识别汉字)函数 
Function LeftTrue(str,n)

If len(str)<=n/2 Then
LeftTrue=str
Else
Dim TStr
Dim l,t,c
Dim i
l=len(str)
t=l
TStr=””
t=0
for i=1 to l
c=asc(mid(str,i,1))
If c<0 then c=c+65536
If c>255 then
t=t+2
Else
t=t+1
End If
If t>n Then exit for
TStr=TStr&(mid(str,i,1))
next
LeftTrue = TStr
End If

End Function

 
‘一个非常简单的将半角”转换为中文“的函数
function new_str(str)
if instr(str,chr(34))<>0 and str<>”” then
str_split=split(str,chr(34))
i=1
str_s=””
for j=0 to ubound(str_split)-1
if i mod 2 then
str_s=str_s&str_split(j)&”“”&str_split(j+1)
else
str_s=str_s&str_split(j)&”””&str_split(j+1)
end if
i=i+1
next
end function  
 

转载于:https://www.cnblogs.com/swordzj/archive/2004/06/30/2034842.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/139637.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • USB PD快充协议_pd快充协议文件

    USB PD快充协议_pd快充协议文件USBPD快充协议

    2022年10月27日
  • 下载jieba 库[通俗易懂]

    下载jieba 库[通俗易懂]步骤:1.打开命令行2.联网3.在C:\Users\User&gt;后面加语句 pipinstalljieba形成 C:\Users\User&gt;pipinstalljieba然后按回车,然后就开始安装在最后一行出现Successfullyinstalledjieba-0.39 证明安装成功  PS由于我们用pip来安装的jieba库嘛…

  • 错误代码as-3_android studio is currently

    错误代码as-3_android studio is currently解决AS编译报错:Causedby:org.gradle.api.internal.plugins.PluginApplicationException:Failedtoapplyplugin[id‘com.android.application’]编译Android项目时总是遇到以上报错,所以记录一下。解决方法:添加android.overridePathCheck=true就可以了。其实解决的方法可以在EventLog窗口中找到,如图下:从日志第一句可以看出,应该是项目路径包

  • 5分钟商学院之个人篇–习惯与素养

    1.高效能人士的习惯思维转换如果只想发生较小的变化,专注于自己的态度和行为;但如果想发生实质性的变化,就需要思维转换,改变理解世界的方式思维转换就是改变人们理解世界的方式,怎样才能打开思维转换

    2021年12月30日
  • D-Link 路由 PCAnyWhere 端口映射

    D-Link 路由 PCAnyWhere 端口映射进入首页 设置固定DHCP服务器主机名称 IP地址(192.168.0.100)  MAC地址进入进阶设定  虚拟服务器建立新的虚拟服务器列表以下三项需建立并激活VirtualServerHTTP 192.168.0.100TCP80/80pcanywhere     192.168.0.100TCP5631/5631pcanywhere     192

  • 武侠世界2-try catch思考

    以前一直不知道trycatch具体应用到什么地方,之前待过的几家公司也看不到有类似的代码。从网上搜来的,描述trycatch优点有下面几点。1、把错误处理和真正的工作分开来;  2、代码更易组织,更清晰,复杂的工作任务更容易实现;  3、毫无疑问,更安全了,不至于由于一些小的疏忽而使程序意外崩溃了;  4、由于C++中的trycatch可以分层嵌套,所以它…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号