ASP产品展示界面网页代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

ASP网页设计代码之产品展示界面1.创建一个pro1.asp.........................................................................................................................22.创建产品详细展示界面proshow.asp...........................................................................................53.创建连接数据库的文件conn.asp.................................................................................................84.创建数据库Data.Mdb...................................................................................................................9亲爱的读友们,下面的代码是我平常工作时会做到的代码,所谓好东西大家一起分享,希望你们看了能够顺利的做出来哦最初一定要新建一个文件夹,无论放在哪里都可以,路径是虚拟路径。但是一定要吧下面几个创建的文件放在同一个文件夹里面。1.创建一个pro1.asp添加以下代码,这里我已经简化成最简化了。所以基本不用再继续删减了。!--#includefile=conn.asp--!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//EN==Content-Typecontent=text/html;charset=gb2312/title无标题文档/title/headbodytablewidth=94%height=100%border=0align=centercellpadding=0cellspacing=0trtdalign=centervalign=topbr/tablewidth=100%border=0cellspacing=0cellpadding=0trtdalign=leftvalign=middle%Bigclassname=Request(Bigclassname)Smallclassname=Request(Smallclassname)setrs=server.createobject(adodb.recordset)ifRequest(Bigclassname)=thensql=selecttop700*fromproductorderbyproduct_IDendififRequest(Bigclassname)andrequest(smallclassanme)=thensql=select*fromproductwherebigclassname='&Bigclassname&'orderbyproduct_IDendififRequest(Bigclassname)andrequest(smallclassname)thensql=select*fromproductwherebigclassname='&Bigclassname&'andSmallclassname='&smallclassname&'orderbyproduct_IDdescendifrs.opensql,conn,1,1ifrs.eoforrs.bofthenresponse.write暂时没有产品记录!endififrequest(page)=thenpage=1elsepage=cint(request(page))endifrs.pagesize=12rs.absolutepage=pageurl=Pro1.asp?BigClassName=&BigClassName&&SmallClassName=&SmallClassName&&page=%spanclass=top_m_txt01%callShowClassGuide()%/span/tdtdalign=rightspanclass=top_m_txt01%callShowArticleTotal()%     /span/td/tr/tabledivalign=lefttablewidth=100%border=0cellpadding=2cellspacing=0tr%fori=1tors.pagesize%tdalign=centertablewidth=180border=0cellpadding=0cellspacing=0trtdclass=style21divalign=centerclass=style21tablewidth=156border=0cellpadding=1cellspacing=0trtdtablewidth=156height=136border=0cellpadding=0cellspacing=1bgcolor=#E1E1E1trtdalign=centervalign=middlebgcolor=#FFFFFFahref=proshow.asp?id=%=rs(id)%target=_blankimgsrc=%=rs(defaultpicurl)%width=150height=150border=0//a/td/tr/tabledivalign=center/div/td/tr/table/div/td/tr/table/td%ifimod4=0thenresponse.write(/trtr)endifrs.movenextifrs.eofthenexitfornext%/tr/tabledivclass=news_pagedivalign=center%ifpage1then%ahref=%=url&1%首页/a  ahref=%=url&cstr(page-1)%上一页/a  %elseresponse.Write(首页上一页)endif%%ifpagers.pagecountthen%ahref=%=url&cstr(page+1)%下一页/a  ahref=%=url&cstr(rs.pagecount)%尾页/a%elseresponse.Write(下一页尾页)endif% 当前第%=page%/%=rs.pagecount%页/div/div/div/td/tr/table%subShowClassGuide()response.write ahref='Product.asp'class='top_m_txt01'产品/a >>ifBigClassName=andSmallClassName=thenresponse.write 所有产品elseifBigClassNamethenresponse.write ahref='Product.asp?BigClassName=&BigClassName&'class='top_m_txt01'&BigClassName&/a >> ifSmallClassNamethenresponse.writeahref='Product.asp?BigClassName=&BigClassName&&SmallClassName=&SmallClassName&'class='top_m_txt01'&SmallClassName&/aelseresponse.write所有小类endifendifendifendsub%%subShowArticleTotal()dimsqlTotaldimrsTotalsqlTotal=selectCount(*)fromProductwherePassed=TrueifBigClassNamethensqlTotal=sqlTotal&andBigClassName='&BigClassName&'ifSmallClassNamethensqlTotal=sqlTotal&andSmallClassName='&SmallClassName&'endifelseifSpecialNamethensqlTotal=sqlTotal&andSpecialName='&SpecialName&'endifendifSetrsTotal=Server.CreateObject(ADODB.Recordset)rsTotal.opensqlTotal,conn,1,1ifrsTotal.eofandrsTotal.bofthentotalPut=0response.write共有0个产品elsetotalPut=rsTotal(0)response.Write共有&totalPut&个产品endifrsTotal.closesetrsTotal=nothingendsub%/body/html2.创建产品详细展示界面proshow.asp在proshow.asp界面添加如下代码!--#includefile=conn.asp--htmlheadmetahttp-equiv=Content-Typecontent=text/html;charset=gb2312/title产品详细信息/title%ShowSmallClassType=ShowSmallClassType_Articledimidid=trim(request(id))ifid=thenresponse.Redirect(Product.asp)endifsql=select*fromProductwhereid=&id&Setrs=Server.CreateObject(ADODB.Recordset)rs.opensql,conn,1,3ifrs.bofandrs.eofthenresponse.writeSCRIPTlanguage=JavaScriptalert('找不到此产品!');response.writejavascript:history.go(-1)/SCRIPTelsers(Hits)=rs(Hits)+1rs.updateifrs(hits)=HitsOfHotthenrs(Hot)=Truers.updateendifBigClassName=rs(BigClassName)SmallClassName=rs(SmallClassName)%styletype=text/css!--body{margin-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;}body,td,th{font-size:12px;f

1 / 9
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功