网页中每篇文章后面的评论功能是怎么实现?拜托各位了 3Q

rt... rt 展开
 我来答
灰机0Cl1
2014-06-19 · 超过68用户采纳过TA的回答
知道答主
回答量:123
采纳率:0%
帮助的人:163万
展开全部
先用表单功能建一个留言模板即你说的评论功能,然后再建一个来连接数据库。 我还是给你看看我的吧,不过你要做下修改哦! 我的留言模板是: <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <html> <head> <title>用户留言</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <style type="text/css"> <!-- a:link { color: #000000; text-decoration: none; } a:visited { text-decoration: none; color: #000000; } a:hover { text-decoration: none; color: #FF9900; } a:active { text-decoration: none; color: #000000; } .style2 {font-size: 16} --> </style></head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <!-- ImageReady Slices (分页.psd) --> <table id="__01" width="1005" height="1453" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td height="209" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="1005" height="209" valign="top" align="right" background="../images/01.jpg"> <a href="#" style="cursor:hand"; onClick="window.external.addfavorite(document.location.href,document.title)">加入收藏</a>   <a href="#" style="cursor:hand"; onClick="this.style.behavior='url(#default#homepage)';this.setHomePage(document.location.host)">设为首页</a>       </td> </tr> </table></td> </tr> <tr> <td height="122" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="1005" height="122" valign="top"> <img src="../images/02.jpg" alt="" width="1005" height="122" border="0" usemap="#Map"></td> </tr> </table></td> </tr> <tr> <td height="924" colspan="2"> <img src="../images/03.gif" width="68" height="924" alt=""></td> <td width="864" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="864" height="924" valign="top" background="../images/04.jpg" align="center"> <div align="left" class="style2"> <div align="left"> <% set conn=server.CreateObject("adodb.connection") dbpath=server.MapPath("../database/db.mdb") conn.open "provider=microsoft.jet.oledb.4.0;data source=" & dbpath set rs=server.CreateObject("adodb.recordset")%> <table width="90%" border="1" cellspacing="0" bordercolor="#E3D3B2"> <tr><td colspan="3" align="center"><strong>大家好!欢迎您在本网页对2008北京奥运会进行留言!</strong></td> </tr> <tr><td>内容</td><td>用户名</td><td>发表时间</td></tr> <%sql="select * from 留言 order by 发表时间 desc" rs.open sql,conn do while not rs.eof%> <tr><td><%=rs("内容")%></td><td><%=rs("用户")%></td><td><%=rs("发表时间")%></td></tr> <% rs.movenext loop%> </table> <br> <br> <%if session("yhid")<>"" then%> </div> </div> <form action="yhly1.asp" method="post" class="style2"> <div align="left"> <table> <tr><td>留言内容:</td><td><textarea cols="40" rows="5" name="lynr"></textarea></td></tr> </table> <input type="submit" value="发表">    <input type="reset" value="重置"> </div> </form> <div align="left" class="style2"> <div align="left"> <%end if%>   </div> </div></td> </tr> </table></td> <td colspan="2"> <img src="../images/05.gif" width="73" height="924" alt=""></td> </tr> <tr> <td width="41" rowspan="2"> <img src="../images/06.gif" width="41" height="197" alt=""></td> <td height="161" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="919" height="161" valign="middle" align="center" background="../images/07.jpg">2009 大赛组委会 @ All rights reserved.<br> 奥ICP备00000000号<br> Email:<a href="mailto:2009guangdong@dasai.cn">2009guangdong@dasai.cn</a><br> Tel:020-26583598  </td> </tr> </table></td> <td width="45" rowspan="2"> <img src="../images/08.gif" width="45" height="197" alt=""></td> </tr> <tr> <td colspan="3"> <img src="../images/09.gif" width="919" height="36" alt=""></td> </tr> <tr> <td> <img src="../images/分隔符.gif" width="41" height="1" alt=""></td> <td width="27"> <img src="../images/分隔符.gif" width="27" height="1" alt=""></td> <td> <img src="../images/分隔符.gif" width="864" height="1" alt=""></td> <td width="28"> <img src="../images/分隔符.gif" width="28" height="1" alt=""></td> <td> <img src="../images/分隔符.gif" width="45" height="1" alt=""></td> </tr> </table> <!-- End ImageReady Slices --> <map name="Map"> <area shape="rect" coords="79,12,212,73" href="../default.asp" alt="首页"> <area shape="rect" coords="255,8,385,71" href="lxxw.asp" alt="联想新闻"> <area shape="rect" coords="429,10,558,73" href="cpzs.asp" alt="产品展示"> <area shape="rect" coords="607,10,737,72" href="yhzc.asp" alt="用户注册"> <area shape="rect" coords="781,12,920,72" href="yhly.asp" alt="用户留言"> </map> <% rs.close set rs=nothing conn.close set conn=nothing %> </body> </html> 连接数据库的是: <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body><% set conn=server.CreateObject("adodb.connection") dbpath=server.MapPath("../database/db.mdb") conn.open "provider=microsoft.jet.oledb.4.0;data source=" & dbpath lynr=request.Form("lynr") yhm=session("yh") fbsj=now() sql="insert into 留言(内容,用户,发表时间)values('"&lynr&"','"&yhm&"','"&fbsj&"')" conn.execute sql response.Redirect "yhly.asp" rs.close set rs=nothing conn.close set conn=nothing %> </body> </html>
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式