这一讲说下评论代码的制作。这个有点麻烦,需要判断用户是否登陆,而我们在页面的头部,已经有一个会员登陆了,这两个有可能会冲突。
找到如下代码:
<SCRIPT>
function CheckPl(obj)
{
if(obj.saytext.value=="")
{
alert("您没什么话要说吗?");
obj.saytext.focus();
return false;
}
return true;
}
</SCRIPT>
<FORM id=saypl onSubmit="return CheckPl(document.saypl)" method=post name=saypl
action=/e/enews/index.php>
<DIV class=comment>
<DIV class=com_t>
<H3>发表评论</H3><SPAN class=com2><A
href="http://www.heatpress123.net">共有<SPAN class=com3>
<SCRIPT type=text/javascript
src="布拉德利:不值得与可汗这种没价值的人比赛_国际拳坛_拳击在线%20-%20QuanJi_Cn%20%20致力于打造最大最全拳击门户!_files/ViewClick.htm"></SCRIPT>
</SPAN>条评论</A></SPAN> </DIV>
<DIV class=com_c>
<TABLE border=0 cellSpacing=2 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD>
<SCRIPT
src="布拉德利:不值得与可汗这种没价值的人比赛_国际拳坛_拳击在线%20-%20QuanJi_Cn%20%20致力于打造最大最全拳击门户!_files/more.htm"></SCRIPT>
</TD></TR></TBODY></TABLE>
<TABLE class=com_c border=0 cellSpacing=2 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD width="56%" align=left>用户名: <INPUT id=username class=inputText size=16
type=text name=username></TD>
<TD width="44%" align=left>密码: <INPUT id=password class=inputText size=16
type=password name=password></TD></TR>
<TR>
<TD align=left>验证码: <INPUT class=inputText size=10 type=text name=key>
<IMG align=absMiddle
src="布拉德利:不值得与可汗这种没价值的人比赛_国际拳坛_拳击在线%20-%20QuanJi_Cn%20%20致力于打造最大最全拳击门户!_files/ShowKey.jpg">
</TD>
<TD align=left><INPUT id=nomember value=1 CHECKED type=checkbox
name=nomember> 匿名发表</TD></TR></TBODY></TABLE><TEXTAREA id=saytext rows=4 name=saytext></TEXTAREA>
<INPUT
src="布拉德利:不值得与可汗这种没价值的人比赛_国际拳坛_拳击在线%20-%20QuanJi_Cn%20%20致力于打造最大最全拳击门户!_files/sub_tjly.gif"
type=image name=imageField> <INPUT idid=id value=6153 type=hidden name=id> <INPUT
id=classid value=9 type=hidden name=classid> <INPUT id=enews value=AddPl
type=hidden name=enews> <INPUT id=repid value=0 type=hidden name=repid> <INPUT
value=/news/1/6153.html type=hidden name=ecmsfrom>
<DIV class=clear></DIV></DIV></DIV></FORM>
修改为:
- <script language="javascript" type="text/javascript">
- <!--
- function CheckLogin1(){
- var taget_obj = document.getElementById('_ajax_feedback');
- myajax = new DedeAjax(taget_obj,false,false,'','','');
- myajax.SendGet2("{dede:global.cfg_cmsurl/}/member/ajax_feedback.php");
- DedeXHTTP = null;
- }
- function checkSubmit(){
- if(document.feedback.msg.value!='') document.feedback.submit();
- else alert("您没什么话要说吗?");
- }
- -->
- </script>
- <DIV class=comment>
- <DIV class=com_t>
- <H3>发表评论</H3><SPAN class=com2><a href="{dede:field name='phpurl'/}/feedback.php?aid={dede:field.id/}">查看所有评论</a></SPAN> </DIV>
- <DIV class=com_c>
- <form action="{dede:field name='phpurl'/}/feedback.php" method="post" name="feedback">
- <input type="hidden" name="action" value="send" />
- <input type="hidden" name="comtype" value="comments">
- <input type="hidden" name="aid" value="{dede:field name="id"/}" />
- <input type="hidden" name="isconfirm" value="yes" />
- <div id="_ajax_feedback">
- <TABLE class=com_c border=0 cellSpacing=2 cellPadding=0 width="100%">
- <TBODY>
- <TR>
- <TD width="56%" align=left>用户名: <INPUT class=inputText size=16 type=text name=username></TD>
- <TD width="44%" align=left>密码: <INPUT class=inputText size=16 type=password name=pwd></TD></TR>
- <TR>
- <TD align=left>验证码: <INPUT class=inputText size=10 type=text name=validate style="text-transform: uppercase;">
- <IMG align=absMiddle src="{dede:global.cfg_cmsurl/}/include/vdimgck.php">
- </TD>
- <TD align=left><INPUT id="dcmp-submit-guest" value=1 CHECKED type=checkbox name=notuser> 匿名发表</TD>
- </TR>
- </TBODY>
- </TABLE>
- </div>
- <script language="javascript" type="text/javascript">CheckLogin1();</script>
- <TEXTAREA rows=4 name=msg></TEXTAREA>
- <INPUT src="{dede:global.cfg_templets_skin/}/images/sub_tjly.gif" type=image name=imageField>
- </form>
- <DIV class=clear></DIV>
- </DIV>
- </DIV>
- 原文链接:http://www.software8.co/wzjs/dedecms/2782.html