?? common.asp
字號(hào):
<%
Function smJSalert(message)
Response.Write "<script language=javascript>alert('"&message&"');history.go(-1);</script>"
End Function
Function smChecknull(nameoff, valueoff, chkerror)
if valueoff = "" then chkerror = chkerror & nameoff & ", "
smChecknull = valueoff
End Function
Function smFixer(datainfo)
smFixer=replace(datainfo,"'","''")
End Function
Function chkEmail(theAddress)
dim atCnt,i
chkEmail = 0
if len(cstr(theAddress)) < 7 then
chkEmail = 1
elseif instr(theAddress,"@") = 0 then
chkEmail = 1
elseif instr(theAddress,".") = 0 then
chkEmail = 1
elseif len(theAddress) - instrrev(theAddress,".") > 3 then
chkEmail = 1
elseif instr(theAddress,"_") <> 0 and _
instrrev(theAddress,"_") > instrrev(theAddress,"@") then
chkEmail = 1
else
atCnt = 0
For i = 1 to len(theAddress)
if mid(theAddress,i,1) = "@" then atCnt = atCnt + 1
Next
if atCnt > 1 then chkEmail = 1
For i = 1 to len(theAddress)
if not isnumeric(mid(theAddress,i,1)) and _
(lcase(mid(theAddress,i,1)) < "a" or _
lcase(mid(theAddress,i,1)) > "z") and _
mid(theAddress,i,1) <> "_" and _
mid(theAddress,i,1) <> "." and _
mid(theAddress,i,1) <> "@" and _
mid(theAddress,i,1) <> "-" then
chkEmail = 1
end if
Next
end if
End Function
Function smIfChecked(fieldname)
if fieldname = "on" then
smIfChecked = "Checked"
else
smIfChecked = ""
end if
End Function
Function smsmIfCheckedDB(fieldvalue,fieldname)
smsmIfCheckedDB = "<select name="&fieldname&">"
if fieldvalue then
smsmIfCheckedDB = smsmIfCheckedDB & "<option selected value="&smumtrue&">Enabled</option><option value="&smumfalse&">Disabled</option></select>"
else
smsmIfCheckedDB = smsmIfCheckedDB & "<option value="&smumtrue&">Enabled</option><option selected value="&smumfalse&">Disabled</option></select>"
end if
End Function
Function smsmIfCheckedTF(fieldname)
if fieldname = "on" then
smsmIfCheckedTF = "True"
else
smsmIfCheckedTF = "False"
end if
End Function
Function smGenerateDate(fday,fmonth,fyear,fdate)
dim daydata, f, monthdata, yeardata,datedata
daydata = "<select name="&fday&">"
For f = 1 to 31
if fdate <> "" then
daydata=daydata& replace("<option value="&f&">"&f&"</option>","value="& day(fdate)&">", "selected value="& day(fdate)&">")
else
daydata=daydata& "<option value="&f&">"&f&"</option>"
end if
Next
daydata=daydata& "</select>"
monthdata= "<select name="&fmonth&">"
For f = 1 to 12
if fdate <> "" then
monthdata=monthdata& replace("<option value="&f&">"&monthname(f,true)&"</option>","value="& month(fdate)&">","selected value="& month(fdate)&">")
else
monthdata=monthdata& "<option value="&f&">"&monthname(f,true)&"</option>"
end if
Next
monthdata=monthdata& "</select>"
yeardata= "<select name="&fyear&">"
For f = 2001 to 2050
if fdate <> "" then
yeardata=yeardata& replace("<option value="&f&">"&f&"</option>","value="& year(fdate)&">","selected value="& year(fdate)&">")
else
yeardata=yeardata& "<option value="&f&">"&f&"</option>"
end if
Next
yeardata=yeardata& "</select>"
datedata=daydata&monthdata&yeardata
smGenerateDate= datedata
End Function
Function smPaging(dataconn,query,topheaderlayout,displaylayout,recsperpage,action,eofmessage,headerdata,iStart)
dim page, ioffset, smumrspagerecords, Recordsar, iRows, iStop, leftrecs, lastpage,_
firstlastdata, navidata, i, navisubdata1, navisubdata, start, iRowLoop,headerdataa,listingar,n,field,order,_
id,records,j,temp,printlayout
if not Application("smumdebugmode") then on error resume next
page = smumadminpage
if Not IsNumeric(iStart) or Len(iStart) = 0 then
iStart = 0
else
iStart = CInt(iStart)
end if
iOffset = recsperpage
Set smumrspagerecords = Server.CreateObject("ADODB.Recordset")
smumrspagerecords.Open query,dataconn
if smumrspagerecords.EOF then
if eofmessage <> "" then
smumFormOpenTable
smumFormHeader "Records not found"
smumFormResponse eofmessage
smumFormCloseTable
end if
smumrspagerecords.Close
Set smumrspagerecords = Nothing
records = false
else
Recordsar = smumrspagerecords.GetRows
smumrspagerecords.Close
Set smumrspagerecords = Nothing
records = true
end if
if records then
iRows = UBound(Recordsar, 2)
If iRows => (iOffset + iStart) Then
iStop = (iOffset + iStart) - 1
Else
iStop = iRows
End If
if istart = 0 and irows = iOffset then iStop = iStop - 1
if istop =< 0 then istop = 0
leftrecs = irows mod iOffset
lastpage = irows - leftrecs
if irows > (iOffset) then firstlastdata = "[ <A HREF="""&page&"?action="&action&"&id="&id&""">First</a> | <A HREF="""&page&"?action="&action&"&id="&id&"&Start=" & lastpage & """>Last</a> ]"
navidata = "<table width=100% cellspacing=0 border=0 cellpadding=0><tr><td><font class=textsize9><b>"& headerdata &"</b> : <b>"&istart+1&" - "&istop+1&"</b> of <b>"& irows+1 &"</b> "&firstlastdata&" </td><td align=right><font class=textsize9>"
for i = 1 to 5
if (iStart+(iOffset*i)) > irows then
navisubdata1 = navisubdata1
else
navisubdata1 = navisubdata1 & "<A HREF="""&page&"?action="&action&"&id="&id&"&Start=" & iStart+(iOffset*i) & """>"&(istart/iOffset)+1+i&"</A> | "
end if
next
if navisubdata1 <> "" then
navisubdata = "Pages [ " & left(navisubdata1, (len(navisubdata1)-2)) & "] "
else
navisubdata = ""
end if
navidata = navidata & navisubdata
if iStart > 0 then
if iStop < iRows then
navidata = navidata & "<A HREF="""&page&"?action="&action&"&field="&field&"&order="&order&"&id="&id&"&Start=" & iStart-iOffset & """>Back</A> | "
else
navidata = navidata & "<A HREF="""&page&"?action="&action&"&field="&field&"&order="&order&"&id="&id&"&Start=" & iStart-iOffset & """>Back</A>"
end if
end if
if iStop < iRows then navidata = navidata & "<A HREF="""&page&"?action="&action&"&id="&id&"&Start=" & iStart+iOffset & """>Next</A>"
navidata = navidata & "</td></tr></table>"
smumFormOpenTable
Response.Write "<tr class=colorformheader><td colspan="&ubound(Recordsar)+2&" ><font class=textsize9><b>"& navidata &"</b></font></td></tr>"
Response.Write topheaderlayout
for iRowLoop = iStart to iStop
printlayout = displaylayout
for j = 0 to ubound(Recordsar,1)
if Recordsar(j,iRowLoop) <> "" then
printlayout = replace(printlayout,"item"&j&"a",Recordsar(j,iRowLoop))
else
printlayout = replace(printlayout,"item"&j&"a","")
end if
next
Response.Write printlayout
next
Response.Write "<tr class=colorformheader><td colspan="&ubound(Recordsar)+2&" ><font class=textsize9><b>"& navidata &"</b></font></td></tr>"
smumFormCloseTable
end if
End Function
%>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -