| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 141377 人关注过本帖, 142 人收藏
标题:新手asp编程的基本法则 [新手必看] 2009-6-17 更新
只看楼主 加入收藏
Believing
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-11-1
收藏
得分:0 
总结得太好了!我有个问题:
ASP  表单登录的文本框的Type属性值可以相互用代码改变吗?像一听音乐的首页登录的密码那样、单击文本框原来的type的属性值是text,有value值  密码、当单击文本框文本框让其值为空、而且type的属性值为password。但好像为了安全  type 不可以相互改变。我该怎么做呢???? 请帮帮忙!!!!谢谢你了!
2012-11-01 22:10
bsj
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-10-31
收藏
得分:0 
就是看不太懂
2012-11-08 19:24
cxy24521523
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-11-12
收藏
得分:0 
新手来支持  好好学习asp
2012-11-12 18:20
happygao
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-11-18
收藏
得分:0 
我也学习了,我也有一些问题。也是单引号和双引号问题,是在函数调用过程中的问题,不能能不能解答一下,谢谢
2012-11-18 16:29
sdf_sdfa92
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-11-24
收藏
得分:0 
对 我很有帮助    顶了  希望 版主 多发表些文章呀!
2012-11-27 15:28
a0427
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2012-12-3
收藏
得分:0 
好帖 对像我这样的新手用处很大
2012-12-04 11:48
cc2006
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-12-7
收藏
得分:0 
谢谢分享,我是初学者,非常实用。
2012-12-07 10:51
lywangzj
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-12-4
收藏
得分:0 
谢谢喽,要好好看看
2012-12-13 11:31
飞飞aichun
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-12-8
收藏
得分:0 
ok ,既然连sql语句都写了,再把存储过程写上会更全,呵呵
2012-12-14 12:44
taosha
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-12-15
收藏
得分:0 
哪位大哥给我看看这段代码,有什么不对的地方,搜索为空时正常,不为空时出现:Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

ODBC 驱动程序不支持所需的属性。

/search.asp,行 253

rs.open sql,conn,1,1  253行在这里
    if rs.eof then response.write "暂无信息"
以前数据库信息不多没有这个问题,现在就不行了
-------------------------------------------------------------------



<!--#include file="top_index.asp"-->
<!--#include file="cls_splitpage.asp"-->
<!--#include file="FormatMyDate.Asp"-->
<!--#include file="CutStr.asp"-->
<%
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", "&gt;")
fString = replace(fString, "<", "&lt;")
fString = Replace(fString, CHR(32), "&nbsp;")
fString = Replace(fString, CHR(9), "&nbsp;")
fString = Replace(fString, CHR(34), "&quot;")
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")

 dim re
  Set re=new RegExp
  re.IgnoreCase =True
  re.Global=True
  re.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
  fString = re.Replace(fString,"<a target=_blank href=$1>$1</a>")
  re.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
  fString = re.Replace(fString,"<a target=_blank href=$1>$1</a>")
  re.Pattern = "([^>='])(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
  fString = re.Replace(fString,"$1<a target=_blank href=$2>$2</a>")
  set re=Nothing

  HTMLEncode = fString
  end if
end function

Function lxname(lx_id,lx_name)
if lx_id<>"" then
w=Len(lx_id)
d=Len(lx_name)
h=InStr(lx_name,"'"&lx_id&"'")
var_lx=Right(lx_name,d-(h+w+2))
d1=InStr(var_lx,",")
lxname=Left(var_lx,d1-1)
else
lxname=""
end if
End Function
%>
    <table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
    <table border="0" width="760" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">
        <tr>
            <td width="200" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table border="0" width="100%" cellspacing="1" cellpadding="0" bgcolor="#DDDDDD">
                    <tr>
                      <td align="center" bgcolor="#FFFFFF"><table  border="0" width="100%" cellspacing="0" cellpadding="5">
                          <tr>
                            <td height="33" background="images/b1t.jpg" align="center" class="Font_12_b">大类目录</td>
                          </tr>
                          <%
                function xinxi_Count(id)
                set rs=Server.CreateObject("ADODB.Recordset")
                SQL = "SELECT id FROM [article] WHERE class ="&id&" and city="&city_id
                rs.open sql,conn,1,1
                xinxi_Count=INT(Rs.recordcount)
                rs.close
                set rs=nothing
                end function
                set rs1=Server.CreateObject("ADODB.Recordset")
                sql1="select * from [class] where ifshow=true order by pnum"
                rs1.open sql1,conn,1,1
                do while not rs1.eof
                %>
                          <tr>
                            <td height="25">
                              &nbsp;&nbsp;<img src=images/Left_Jt_H.gif align="absmiddle">&nbsp;<a href="class.asp?city=<%=city_id%>&class=<%=RS1("id")%>"><%=rs1("class")%></a>
                              <%
                rs1.movenext
                if not rs1.eof then
                response.write "</td></tr>"
                else
                response.write "</td></tr>"
                end if
                loop
                rs1.close
                set rs1=nothing
                %>
                        </table></td>
                    </tr>
                </TABLE></td>
              </tr>
              <tr>
                <td height="5"></td>
              </tr>
              <tr>
                <td><script type="text/javascript"><!--
        google_ad_client = "pub-1166438123345321";
        google_ad_width = 200;
        google_ad_height = 200;
        google_ad_format = "200x200_as";
        google_ad_type = "image";
        google_ad_channel = "";
        //-->
            </script>
                    <script type="text/javascript"
        src="http://pagead2.
              </script>
                </td>
              </tr>
              <tr>
                <td height="3"></td>
              </tr>
            </table></td>
            <td align="right" valign="top"><table width="550" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DDDDDD">
                  <tr>
                    <td bgcolor="#FFFFFF"><table width="550" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="5%" valign="baseline" class="Font_14_b">&nbsp;</td>
                                <td width="57%" valign="baseline" class="Font_14_b"><img src="images/homehomeh1.gif" width="29" height="36" align="absmiddle">查看您所搜索的结果</td>
                                <td width="38%" align="right"><table width="99" height="29" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                      <td align="center" background="images/home_r_bg5.gif"><img src="images/home_i_b.gif" width="19" height="17" align="absmiddle">
                                          <%if session("userid")="" then%>
                                        <a href="/pub.asp?city=<%=city_id%>" class="font_14_H_28">免费发布</a>
                                        <%else%>
                                        <a href="/user_pub.asp?city=<%=city_id%>" class="font_14_H_28">免费发布</a>
                                        <%end if%>                                      </td>
                                    </tr>
                                </table></td>
                              </tr>
                          </table></td>
                        </tr>
                        <tr>
                          <td><table width="100%" border="0" cellpadding="10" cellspacing="1" bgcolor="#D7D7D7">
                              <tr>
                                <td valign="top" bgcolor="#FFFFFF">地区分类:<%      
        set rs=Server.CreateObject("ADODB.Recordset")
        sql="select top 15 * from [area] where ifshow=true and city="&abs(city_id)&" order by pnum"
        rs.open sql,conn,1,1
        if not rs.eof then
        ii=1
        do while not rs.eof         
        i=0
        response.write ""&vbcrlf      
        do while i<3 and not rs.eof
        if ii<15 then
        response.write "<a href=search.asp?city="&city_id&"&keyword="& replace(request("keyword"),"'","") &"&class="&request("class")&"&area="&rs("id")&" class=Font_12_O>"&rs("area")&"</a>"&vbcrlf
        else
        response.write "<a href=area.asp?city="&city_id&"&type=area class=Font_12_O>其他县区</a>"&vbcrlf
        end if
        rs.movenext
        i=i+1
        ii=ii+1
        loop        
        response.write ""&vbcrlf
        loop
        rs.close
        set rs=nothing
        else
        response.write "暂无分区"
        end if      
        %></td>
                              </tr>
                          </table></td>
                        </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td height="10"></td>
              </tr>
              <tr>
                <td><table width="550" border="0" cellpadding="0" cellspacing="1" bgcolor="#DDDDDD">
                  <tr>
                    <td bgcolor="#FFFFFF"><table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">
                        <tr>
                          <td><table border="0" width="100%" cellspacing="0" cellpadding="0" border="0">
                              <tr>
                                <td valign="top">
                                    <table border="0" width="550" cellspacing="0" cellpadding="5">
                                    <tr>
                                        <td background="images/b1t.jpg" height="33" style="color:red">搜索结果:</td>
                                    </tr>
                                    <tr>
                                        <td height="33" style="color:red">
                                            <table border="0" width="530" align="center" cellspacing="0" cellpadding="0">
                                            <tr bgcolor="#F7F7F7" height="28">
                                                <td width="310">类型 信息标题</td>
                                                <td width="100">发布人</td>
                                                <td width="120" align="right">发布日期</td>
                                            </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    </table>
                                    <%
                     
        Function cname(c_id,c_name)
        w=Len(c_id)
        d=Len(c_name)
        h=InStr(c_name,"'"&c_id&"'")
        var_c=Right(c_name,d-(h+w+2))
        d1=InStr(var_c,",")
        cname=Left(var_c,d1-1)
        End Function
        Function lxname(lx_id,lx_name)
        w=Len(lx_id)
        d=Len(lx_name)
        h=InStr(lx_name,"'"&lx_id&"'")
        var_lx=Right(lx_name,d-(h+w+2))
        d1=InStr(var_lx,",")
        lxname=Left(var_lx,d1-1)
        End Function
    set rs3=Server.CreateObject("ADODB.Recordset")
    sql3="select * from c"
    rs3.open sql3,conn,3,3
    mypx=rs3("px")
    set rs=Server.CreateObject("ADODB.Recordset")
    sql="select * from article where stoptime>#"&date()&"# and ifpi=true"
    if request("class")<>"" and  request("class")<>"全部分类" then
    sql=sql&" and class="&abs(request("class"))
    end if
    if request("area")<>"" and  request("area")<>"全部地区" then
    sql=sql&" and area="&abs(request("area"))
    end if
    if request("keyword")<>"" then
    sql=sql&" and (user like '%" & replace(request("keyword"),"'","") & "%' or body like '%" & replace(request("keyword"),"'","") & "%' or url like '%" & replace(request("keyword"),"'","") & "%' or qq like '%" & replace(request("keyword"),"'","") & "%' or title like '%" & replace(request("keyword"),"'","") & "%')"
    end if
   
   

    sql=sql& " order by toptype desc,"
    if rs3("ifpnum")=true then
    sql=sql&" pnum desc,"
    end if
    sql=sql&" "&mypx&" desc"
    rs3.close
    set rs3=nothing
    rs.open sql,conn,1,1
    if rs.eof then response.write "暂无信息"

        
        Dim Page, I
        Set Page = New Cls_SplitPage
        With Page
        .Con = COnn
        .Sql = Sql
        .PageSize = 20 ' @ 修改分页条数
        End With
        Set Rs = Page.Rs
        For I = 1 To Page.PageSize
        If Rs.Eof Then Exit For
        
        
        set rs1=Server.CreateObject("ADODB.Recordset")
        sql1="select * from [user] where id="&rs("userid")&""
        rs1.open sql1,conn,1,1
        if not rs1.eof then
        temuser="<div title=浏览此会员发布的所有信息><font color=#000080><u>"&rs1("username")&"</u></font></div>"
        temuser2=""&rs1("id")&""
        else
        temuser="游客"
        temuser2="0"
        end if
        rs1.close
        set rs1=nothing
        
%>
                                    <table border="0" width="530" align="center"cellspacing="0" cellpadding="0">
                                      <tr onMouseOver="this.bgColor='#F7F7F7';" onMouseOut="this.bgColor='#FFFFFF';">
                                        <td width="310" height="26"><%if rs("leixing")<>"" then%><%=lxname(rs("leixing"),leixing)%><%end if%> <a <%if rs("htmlurl")<>"" then %>href='/html/<%=xxsc_Path&rs("htmlurl")%>'<%else%>href=read.asp?id=<%=rs("id")%><%end if%> title=<%=rs("title")%> target=_blank>
                                          <%if rs("color")<>"默认" then response.write "<font color="&rs("color")&">"%>
                                          <%if rs("xie")=true then response.write "<i>"%>
                                          <%if rs("xia")=true then response.write "<u>"%>
                                          <%=rs("title")%>
                                          <%if rs("color")<>"默认" then response.write "</font>"%>
                                          <%if rs("xie")=true then response.write "</i>"%>
                                          <%if rs("xia")=true then response.write "</u>"%></a>&nbsp;
                                          <%if rs("toptype")>0 then response.write "<font color=red><b>顶</b></font>"%>
                                        </td>
                                        <td width="100"><%if temuser2=0 then%><%=temuser%><%else%><a href="u_class.asp?city=<%=city_id%>&userid=<%=temuser2%>"><%=temuser%></a><%end if%> </td>
                                        <td align="right" width="120"><%=FormatMyDate(rs("addtime"),"{Y}-{m}-{d} {h}:{mi}:{s}")%></td>
                                      </tr>
                                      <tr>
                                        <td height="1" colspan="3" background="images/Class_X.gif"></td>
                                      </tr>
                                    </table>                                </td>
                              </tr>
                              <tr>
                                <td>
                                    <table width="530" border="0" cellspacing="0" cellpadding="0" align="center"></tr>
                                        <% Rs.MoveNext:Next %>
                                        <tr>
                                        <tr>
                                        <td height="5" colspan="3" ></td>
                                        </tr>
                                        <td colspan="3">
                        <%= Page.ShowPage %></td>
                                        </tr>
                                        <tr>
                                        <td colspan="3">
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
                                            <tr>
                                            <td>
                                            <script type="text/javascript"><!--
                                            google_ad_client = "pub-1166438123345321";
                                            google_ad_width = 468;
                                            google_ad_height = 15;
                                            google_ad_format = "468x15_0ads_al_s";
                                            google_ad_channel = "";
                                            google_color_border = "FFFFFF";
                                            google_color_bg = "FFFFFF";
                                            google_color_link = "000099";
                                            google_color_text = "000000";
                                            google_color_url = "008000";
                                            //-->
                                            </script>
                                            <script type="text/javascript"
                                            src="http://pagead2.
                                            </script>
                                            </td>
                                            </tr>
                                            </table>
                                        </td>
                                        </tr>
                                        <tr>
                                        <td height="5" colspan="3" ></td>
                                        </tr>
                        <% Rs.Close:Set Rs = Nothing %>
                                    </table>
                                </td>
                              </tr>
                          </table>
                          </td>
                        </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
      </tr>
</table>
    <!--#include file="bottom.asp"-->
2012-12-15 12:45
快速回复:新手asp编程的基本法则 [新手必看] 2009-6-17 更新
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.063612 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved