平平是IE,你看到的ie8跟我看到的ie10就是不一樣
特別是套用css後
這次用的是IETester,可以檢視原始檔,還不錯用,可以試試。
網路上有免安裝中文版。一次測到爽(囧)。
<% 'Response.Write(isValidate("ac4中123") & "<br>") 'Response.Write(isValidate("ac4123") & "<br>") Function isValidate(str) Dim re Set re = new RegExp re.Pattern = "[^a-zA-Z0-9]" isValidate = re.Test(str) End Function %> |
function ContainsChtString(str) dim x,tmp tmp = false for x = 1 to len(str) if asc(mid(str,x,1)) > 32 and asc(mid(str,x,1)) < 127 then tmp = true exit for end if next ContainsChtString= tmp end function if ContainsChtString(Name) then error_mag = "字串包含特殊符號、數字和大小寫英文字" end if |
Char/NChar/VarChar/NVarChar/Text/NText,這幾個資料型別或許有些人很熟,有些人只熟其中幾個,尤其是程式設計師,不碰DB Design的,如果有碰到,也可能依"慣例"的去設定資料型別,所以不難看見,有些Table資料型別很單調,看的到的型別不多,只要是存文字的,都是NVarChar,或許在瞭解後,可以做出更好的規劃. 其實這個的識別方式很簡單.
這樣就把Char全部講完,剩Text跟Char有什麼不同,Text的特性跟VarChar一樣,只是用來儲存大量的文字資料,但後來的VarChar也做了調整,也可以存大量的文字資料,所以Text在未來新版的DB會移除.
如果您有支援多國語言的網站,請考慮利用 Unicode nchar 或 nvarchar 資料類型,將字元轉換問題減到最少。如果您使用 char 或 varchar,我們建議您執行下列動作:
|
開啟 C:\WINDOWS\system32\inetsrv\metabase.xmlAspBufferingLimit="4194304" \\下載限制AspMaxRequestEntityAllowed="204800" \\上傳限制
fPath = Server.MapPath("file\") Set fs=Server.CreateObject("Scripting.FileSystemObject") '擷取使用者上傳檔名 Set folder = fs.GetFolder(fPath) For each f in folder.files fName = f.Name Next set fs=nothing |
--建立測試表格
CREATE TABLE [dbo].[WIPPrd](
[ProdNo] [varchar](16) NOT NULL,
[PnameD] [nvarchar](100) NULL,
[PType] [varchar](4) NULL,
[InDay] [datetime] NULL,
[UsrNo] [varchar](10) NULL,
[UsrCo] [varchar](5) NULL) ON [PRIMARY]
--建立記錄檔
CREATE TABLE [dbo].[WIPPrd_Log](
[MState] [varchar] (10) NOT NULL,
[ProdNo] [varchar](16) NOT NULL,
[PnameD] [nvarchar](100) NULL,
[PType] [varchar](4) NULL,
[InDay] [datetime] NULL,
[UsrNo] [varchar](10) NULL,
[UsrCo] [varchar](5) NULL )
--建立TRIGGER-在WIPPrd表格更新、新增、
CREATE TRIGGER dbo.TR_WIPPrd_Modify on dbo.WIPPrd AFTER UPDATE,INSERT,DELETE
AS
BEGIN
--
--兩個表格格式資訊皆與原表格相同
--inserted紀錄insert資料、update後資料
--deleted紀錄delete資料、update前資料
--依據異動方式將異動資料新增到記錄檔
--inserted和deleted皆有資料表示為-
IF EXISTS (select 1 from inserted) and EXISTS (select 1 from deleted)
BEGIN
insert into WIPPrd_Log select 'DELETE',* from deleted
insert into WIPPrd_Log select 'INSERT',* from inserted
END
--inserted有資料deleted無資料表示為-
ELSE IF EXISTS (select 1 from inserted) and Not EXISTS (select 1 from deleted)
insert into WIPPrd_Log select 'INSERT',* from inserted
--inserted無資料deleted有資料表示為-
ELSE IF NOT EXISTS (select 1 from inserted) and EXISTS (select 1 from deleted)
insert into WIPPrd_Log select 'DELETE',* from deleted
END
--測試
--清空資料
delete from WIPPrd
delete from WIPPrd_log
--新增資料
insert into WIPPrd values ('11','TEST_11','11',GETDATE()
insert into WIPPrd values ('22','TEST_22','22',GETDATE()
--更新資料
update WIPPrd set ProdNo='33',PnameD='TEST_33' where ProdNo='22'
--刪除資料
delete from WIPPrd
--查詢記錄檔
select * from WIPPrd_log
------------------------------------------------------------ INSERT 11 TEST_11 11 2012-02-26 14:17:47.750 Dean 10001 INSERT 22 TEST_22 22 2012-02-26 14:17:47.763 Dean 10001 DELETE 22 TEST_22 22 2012-02-26 14:17:47.763 Dean 10001 INSERT 33 TEST_33 22 2012-02-26 14:17:47.763 Dean 10001 DELETE 33 TEST_33 22 2012-02-26 14:17:47.763 Dean 10001 DELETE 11 TEST_11 11 2012-02-26 14:17:47.750 Dean 10001 |
<form name="frmform" method="post" action="f100.asp?
<input type=button value="儲存" onclick='run_submit();' class="formcss">
'...
</html>
<script language="javascript">
function run_submit(){
var url="b010.asp"
frmform.action=url;
var xwin = Newopenurl("about:blank","
frmform.target = "xwin";
if(xwin.opener==null) xwin.opener=window; //設定新視窗和舊視窗的關係
frmform.submit();
}
</script>
|
'儲存功能
'...
<script language=javascript>
//關閉子視窗,且重整父視窗。
window.close();
window.opener.location.reload(
</script>
|
<!--撰寫2個form-->
<!--第一個form-->
<form name="form" method="post" action="f010.asp?
<!--第二個form-->
<!--第二個form,將儲存功能寫在另一個asp裡面,--
<form name="form1" method="post" action="q010.asp?id=<%=P_id%>&no=<%
<INPUT class=formcss_other type=submit value="儲存" name=save>
|
'儲存功能
'...
<script language=javascript>
alert ("個人費用登記作業成功!!")
window.location.href="/f010.asp?id=<%=P_
</script>
|
<% sqlstr = "SELECT top 1 * FROM WebCount" Set Rs = Server.CreateObject("ADODB.Recordset") Rs.open sqlstr,connE, 1, 3 if session("RemoteAddr_E") = "" or session("RemoteAddr_E") <> Request.ServerVariables("Remote_Addr") then Rs("Web_Count") = Rs("Web_Count") + 1 session("RemoteAddr_E") = Request.ServerVariables("Remote_Addr") Rs.update Web_E_Count = "0000000" & Rs("Web_Count") Session("Web_E_Count") = right(Web_E_Count,7) End if Rs.close set Rs = nothing %> |
<% '將圖片欄位讀出,並存入 strUrl 變數中 Dim strUrl Do While not RS.EOF strUrl = strUrl & RS("图片") RS.MoveNext Loop '將 strUrl 折解,並存入 arrUrl 陣列中 Dim arrUrl arrUrl = Split(strUrl, ";") '1、檢查遠端檔案是否存在,若不存在則警告訊息,但不影響程式進行 '2、檢查本地有否對應目錄,若不存在則建立目錄 '3、將遠端檔案下載到本地 Dim winPath1, winPath2 Dim arrPath Dim FileName Dim i, j Dim Total Dim ErrText winPath1 = "E:\Temp\PULADA\" '此目錄必須自己手動建立 For i = LBound(arrUrl) to UBound(arrUrl) - 1 '將 arrUrl(i) 拆解為另一陣列 arrPath,以便取得完整檔名 arrPath = Split(Replace(arrUrl(i), "http://" , ""), "/") '取得完整檔名 FileName = arrPath(UBound(arrPath)) '1、檢查遠端檔案是否存在,若不存在則警告訊息,但不影響程式進行 Set XMLHTTP = Server.Createobject("MSXML2.ServerXMLHTTP.5.0") XMLHTTP.Open "GET", arrUrl(i), false XMLHTTP.Send() '判斷遠端檔案是否存在,200 代表存在,404 代表不存在 If XMLHTTP.Status <> 200 Then Response.Write "<font color=FF0000>第 " & i + 1 & " 筆:失敗" & "<br>" '記錄錯誤訊息,然後在程式執行完後顯示 ErrText = ErrText & arrUrl(i) & "<br>" Else RemoteFile = XMLHTTP.ResponseBody '2、檢查本地有否對應目錄,若不存在則建立目錄 Set FSO = Server.CreateObject("Scripting.FileSystemObject") For j = LBound(arrPath) to UBound(arrPath) - 1 winPath2 = winPath2 & arrPath(j) & "\" '判斷目的目錄是否存在,若不存在則建立 If not FSO.FolderExists(winPath1 & winPath2) Then FSO.CreateFolder(winPath1 & winPath2) End If Next Set FSO = Nothing '3、將遠端檔案下載到本地 Set objAdostream = Server.Createobject("ADODB.Stream") objAdostream.Open() objAdostream.Type = 1 objAdostream.Write(RemoteFile) objAdostream.SaveToFile(winPath1 & winPath2 & FileName), 2 '2 代表不詢問,直接覆蓋 objAdostream.SetEOS Set objAdostream = Nothing Response.Write "<font color=0000FF>第 " & i + 1 & " 筆:成功" & "<br>" '記錄成功的筆數 Total = Total + 1 'winPath 必須清除內容,不然會出現建立目錄時產生無限迴圈 winPath2 = "" End If Response.Flush Response.Clear Next Response.Write "<br><br>" Response.Write "<font color=0000FF>總相片數應為:</font>" & UBound(arrUrl, 1) & "<br>" Response.Write "<font color=0000FF>實際下載數為:</font>" & Total & "<br>" Response.Write "<font color=0000FF>未下載的連結:</font>" & "<br>" & ErrText & "<br>" %> |
<% Function postFormData(url, data) Dim xhr : Set xhr = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0") xhr.open "POST", url, false xhr.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" xhr.send Data postFormData=xhr.Status '錯誤代碼 '自訂錯誤內容 ' If (xhr.Status = 200) then ' postFormData = xhr.ResponseText ' ElseIf (xhr.Status = 404) then ' postFormData = xhr.ResponseText ' Else ' Err.Raise 1001, "postFormData", "Post to " & url & " failed with " & xhr.Status ' End If set xhr = Nothing End Function %> <% '如果A電腦沒有檔案,抓取B電腦的 url="http://100.100.100.111/big5/gencaa/upload/" & Rs("FilePath") if postFormData(url,"") = 404 then mail.AddAttachment "http://100.100.100.222/big5/gencaa/upload/" & Rs("FilePath") else mail.AddAttachment "http://100.100.100.111/big5/gencaa/upload/" & Rs("FilePath") end if %> |
dim WShShell,fs,f Set WShShell = Server.CreateObject("WScript.Shell") set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.CreateTextFile(Server.Mappath("C.bat"),true) 'f.write("copy " & Server.Mappath("aa.txt") & " " & Server.Mappath("bb.txt") & " /Y") f.write("copy D:\WebSite\aa.txt D:\WebSite\bb.txt /Y") f.close WShShell.Run Server.Mappath("C.bat"), 1, True set f=nothing set fs=nothing set WShShell=nothing |
<head> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> <style type="text/css"> /*IE和Chrome*/ html {overflow-y:scroll;filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);-webkit-filter: grayscale(100%);} /*IE*/ body *{ filter:gray; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } </style> </head> |