[Original] ASP development skills highlights 2
Last Update:2018-12-05
Source: Internet
Author: User
11. An error is returned. If Rs. bof and Rs. EOF then' Still problematic
Response. Write "<script language = JavaScript> alert ('cannot be found! ');"
Response. Write "javascript: history. Go (-1) </SCRIPT>"
End if
-----------------------------------
This is a jump.
<Script language = "JavaScript">
Alert ('<% = Your perationinfo %> ');
Window. navigate ('changepwd. asp ');
</SCRIPT> 12. Slave Vbs To JS , Mixed <%
Dim checkpwdconfig
Checkpwdconfig = Split (addation ,"/")
%>
<Script language = "JavaScript">
Alert ("<% = checkpwdconfig (0) %> ")
</SCRIPT> 13. Pop-up window <Script language = JavaScript>
Function openaddnew ()
{
Subwindow = Window. Open ("../edit/passwordconfigedit. asp? Method = new ",'', 'scrollbars = Yes, Left = 120, Top = 60, Height = 250, width = 500, menubar = No, location = No, toolbar = No, resizable = Yes ','')
Subwindow. Opener = this;
}
</SCRIPT> call with a connection:
<A href = "" # ""> change the password onclick = "openaddnew ()" </a> image call:
. GIF" onclick = "openaddnew ()"> 14. Paging <! -- # Include file = "conn. asp" -->
<%
If request ("pageno") <> "then
Pageno = int (Request ("pageno "))
Else
Pageno = 1
End ifsql = "select * from news where [language] = 'Chinese' and bigclassname = 'News' order by id desc"
Set rs = server. Createobject ("ADODB. recordset ")
Rs. Open SQL, Conn, 1, 3
Rs. pagesize = 20
If Rs. EOF then
Pageno = 0
Else
Rs. absolutepage = pageno
End if
%>
========================================================== =
Total <% = Rs. recordcount %>, <% = pageno %>/<% = int (RS. pagecount) %> page, per page <% = Rs. pagesize %> entries
<A href = "manage. asp? Pageno = 1 "> homepage </a>
<% If pageno> 1 then %>
<A href = "manage. asp? Pageno = <% = int (pageno)-1%> "> previous page </a>
<%
End if
If int (pageno) <> int (Rs. pagecount) then
%>
<A href = "manage. asp? Pageno = <% = int (pageno + 1) %> "> next page </a>
<% End if %>
<A href = "manage. asp? Pageno = <% = int (Rs. pagecount) %> "> last page </a>
<% Rs. Close %>
<% Call closeconn ()
%> 15. Database Update SQL = "select * from [user] Where username = '" & request ("username ")&"'"
Rs. Open SQL, Conn, 1, 3
RS ("usermail") = request ("usermail ")
RS ("userhome") = request ("userhome "))
Rs. Update
Rs. Close 16. Close independent window <Head>
<Object ID = closes type = "application/X-oleobject" classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11"> <Param name = "command" value = "close">
</Object>
</Head>
<Body>
<Input type = "button" value = "click I close the window" onclick = "closes. Click ();">
</Body> 17. Extremely fine table <Table border = "1" cellpadding = "0" cellspacing = "0" width = "32" Height = "32" bordercolorlight = "#000000" bordercolordark = "# ffffff">
<Tr>
<TD> </TD>
</Tr>
</Table> 18. Several Regular Expressions Require:/. + /,
Email:/^/W + ([-+.] /W +) * @/W + ([-.] // W + )*/. /W + ([-.] /W +) * $ /,
Phone:/^ (/d {3}/) | (/d {3 }/-))? (/(0/d {2, 3}/) | 0/d {2, 3 }-)? [1-9]/d {6, 7} $ /,
Mobile:/^ (/d {3}/) | (/d {3 }/-))? 13/d {9} $ /,
URL:/^ http: // [A-Za-z0-9] +/. [A-Za-z0-9] + [// = /? % /-&_~ '@ [/]/': +!] * ([^ <>/"/"]) * $ /,
Idcard: // ^/d {15} (/d {2} [A-Za-z0-9])? $ /,
Currency:/^/d + (/./d + )? $ /,
Number:/^/d + $ /,
ZIP:/^ [1-9]/d {5} $ /,
QQ:/^ [1-9]/d {4, 8} $ /,
Integer:/^ [-/+]? /D + $ /,
Double:/^ [-/+]? /D + (/./d + )? $ /,
English:/^ [A-Za-Z] + $ /,
Chinese:/^ [/u0391-/uffe5] + $ /,
Unsafe:/^ ([A-Z] * | [A-Z] * |/D * | [-_/~! @ #/$ %/^ &/*/./(/)/[/]/{/} <> /? //// '/"] *) |. {0, 5}) $ |/S /, 19. Left Application (control words) Function title (STR)
If Len (TRIM (STR)> = 28 then
Title = left (TRIM (STR), 27 )&"..."
Else
Title = trim (STR)
End if
End Function 20. Browser judgment <Script language = "javascript1.2">
<! --//
If (navigator. appname = 'netscape ')
VaR Language = navigator. language;
Else
VaR Language = navigator. browserlanguage;
If (language. indexof ('en')>-1) document. Location. href = 'en/index. asp ';
Else if (language. indexof ('zh ')>-1) document. Location. href = 'cn/index. asp ';
Else
Document. Location. href = 'cn/index. asp ';
// End -->
</SCRIPT>