asp 总结一

1.动态显示列表框内容:

<select class="wenbenkuang"  name="shopxpbe_id">

    <option value="0" selected>所有分类</option>

    <%do while not rs.eof%>

    <option value="<%=rs("shopxpbe_id")%>"><%=trim(rs("shopxpbe_name"))%></option>

    <%rs.movenext

                     loop

                     rs.close

                     set rs=nothing%>

  </select>

2.SESSION判断用户是否已经登陆

<table border="0" width="340" align="left" cellpadding="0" cellspacing="0">

                   <tr>

                   <td width="226">

        

                   </td>

                    <% if session("shopuser")="" then %>

                          <%if request.Cookies("shopxp")("username")="" or request.Cookies("shopxp")("reglx")="" then %>

                          <%else%>

                            <td bgcolor="#E7E7E7">&nbsp;<font color="#FF0000"><%=request.Cookies("shopxp")("username")%></font><a href="xplogout.asp">退出</a></td>

                            <%end if%>

           <%else%>

           <td bgcolor="#E7E7E7">&nbsp;<font color="#FF0000"><%=session("shopuser")%></font>,<a href="out.asp">退出</a></td>

           <%end if%></tr>

                   </table>    

3.图片向上滚动显示

1.

<marquee onMouseOver=this.stop()  direction="up" align="left"

                                                                             onMouseOut=this.start()

                                                                  scrollamount="4" height="360">

                                                                           <%

                                                                           sqrr="select * from auctions where aucended<>'Y' and aucitemowner="& rsshop("shopownerid") &" order by aucCurrentBid DESC"

                                                                            call sql_aucmm(sqrr)

                                                                           %>

                                                                           </marquee>

2.

Function sql_aucmm(sql)

'图片显示

response.Write("&nbsp;&nbsp;")

    response.write"<table cellpadding=0 cellspacing=0 border=0 width=300 align=left>"

    response.write"<TR valign=top width=300 height=120 >"

                      response.Write("<td width=150 align=center>")

                    set rs=server.createobject("ADODB.recordset")

                    rs.open sql,conn,1,1

                    if rs.eof or rs.bof then

                            response.write"<td align=center width=150>没有商品</td>"

                    else

                      i=0

                      Do while not rs.eof

                     %>

                     <table border="0" width="200" cellpadding="0" cellspacing="0" align="center" >

                                      <tr>

                                               <td rowspan="2" width="100">

                                                        <%   

                                                        response.Write("&nbsp;&nbsp;")

                                                        call display_imgm(rs("aucid"),4)

                                                        response.Write("<br>")

                                                        %>

                                               </td>

                                               <td width="100">商品名称:<br>&nbsp;

                                                        <%   

                                                        response.Write("<a href='../aucinfo.asp?aucid="&rs("aucid")&"'>")

                                                        if len(rs("aucitemtitle"))> 10 then

                                                                 response.Write(left(rs("aucitemtitle"),8)&"...")

                                                        else

                                                                 response.Write(rs("aucitemtitle"))

                                                        end if

                                                        response.Write("</a>")

                                                        %>   

                                                </td>

                                       </tr>

                                       <tr>

                                               <td>

                                               <%

                                               if rs("auctype")=2 then response.write"一口价:"

                                    

                                               %>&nbsp;<font color="#FF0000"><%=rs("aucCurrentBid")%></font></td>

                                       </tr>

                     </table>

                     <%

                      i=i+1

                      if i>15 then

                           Exit Do

                      end if

                            if i mod 2 =0 then

                            response.Write("</td></tr><tr valign=top height=120 whidth=300><td width=100 align=center>")

                            else

                            response.Write("</td><td width=120>")

                            end if

                      rs.MoveNext

                      Loop

                      rs.close

                      set rs=nothing

                    end if

                   response.write"</TR>" & vbcrlf

                   response.write"</table>" & vbcrlf

 

End Function

(4)       QQ再线交谈

1.        显示QQ连接图片和函数

<%call Display_userqq(rs ("userqq"))%>       

2.函数内容

Function Display_userqq(qqnum)

response.write"<a target=blank href=http://wpa.qq.com/msgrd?V=1&Uin="&qqnum&"&Site="&SYS_WEBNAME&"><img border=""0"" SRC=http://wpa.qq.com/pa?p=1:"&qqnum&":3 alt=""联系卖家QQ""></a>"

End Function

(5)       MD5密码加密

1.        引入加密文件: <!--#include file="usershopxp/md5.asp"-->

2.        注册加密: rs("userpassword")=md5(trim(request("userpassword")))

 (6 )  截取前几个字符显示标题

1.  <table border="0" cellpadding="0" cellspacing="0" width="198">

 <%

         set rs=server.CreateObject("adodb.recordset")

         rs.open "select Top 15 * from shops where shoptuijian=1 order by shopregtime ",conn,1,1

         do while not rs.eof

         %>

          <tr height="20">

  <td width="197" height="20" align="left" valign="middle"><img src="image/t_03.jpg" width="13" height="14" border="0" /><a href="dianpu.asp?shopid=<%=rs("shopid")%>">

          <% if len(rs("shop_name"))>8 then

         response.Write(left(rs("shop_name"),8))

           else

         response.Write(rs("shop_name"))

            end if

         %>

</a><font color="#999999">(</font><font color="#FF0000"><%=rs("shopclick")%></font><font color="#0099FF"></font><font color="#999999">)</font></td>

</tr>

                    <%

                            rs.movenext

                            loop

                            rs.close

                            set rs=nothing

                   %>

</table>

 

2. <% if len(trim(rs("shopxpptname")))>20 then

                            response.write left(trim(rs("shopxpptname")),18)&".."

                            else

                            response.write trim(rs("shopxpptname"))

                            end if%>

(6)       验证码的实现 (原文件: GetshopxpCode.asp

 1. <td width="40%" align="right">验证码:</td>

  <td width="60%"><input class=wenbenkuang name=verifycode type=text value="<%If GetCode=9999 Then Response.Write "9999"%>" maxLength=4 size=10>

  <img src=GetshopxpCode.asp> </td>

7)网页中弹出窗口

<script language="javascript" >

         window.open ('dv.html', 'newwindow', 'height=524, width=745, top=5, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')

         /*window.open ('tuangou.html', 'newwindow2', 'height=660, width=760, top=20,left=10, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no') */

</script>

(8) 弹出内容(窗口)

<a href="javascript:;" onClick="javascript:window.open('viewnimingdingdan.asp?dan=<%=trim(rs("dingdan"))%>&username=<%=username%>','','width=710,height=388,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;"><%=trim(rs("dingdan"))%></a>

(9) 选择列表框选择出发事件

<select name="select" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" ><base target=Right>

         <option value="editnimingdingdan.asp?zhuangtai=0" selected>--选择查讯状态--</option>

         <option value="editnimingdingdan.asp?zhuangtai=0" >全部订单状态</option>

         <option value="editnimingdingdan.asp?zhuangtai=1" >未作任何处理</option>

         <option value="editnimingdingdan.asp?zhuangtai=2" >用户已经划出款</option>

         <option value="editnimingdingdan.asp?zhuangtai=3" >服务商已经收到款</option>

         <option value="editnimingdingdan.asp?zhuangtai=4" >服务商已经发货</option>

         <option value="editnimingdingdan.asp?zhuangtai=5" >用户已经收到货</option>

         </select>

你可能感兴趣的:(asp)