dedecms顶和踩的功能提示有js错误
dedecms顶和踩的功能提示有js错误这一句<scriptlanguage="javascript"type="text/javascript">getDigg({de...
dedecms 顶和踩的功能 提示有js错误
这一句
<script language="javascript" type="text/javascript">getDigg({dede:field.id/});</script>
我看网上都是这么写的,哪有问题呢?
求助。。。 展开
这一句
<script language="javascript" type="text/javascript">getDigg({dede:field.id/});</script>
我看网上都是这么写的,哪有问题呢?
求助。。。 展开
1个回答
2013-08-08
展开全部
套用dedecms顶、踩功能三步骤:
1、头部引入js:
<script language="javascript" type="text/javascript" src="{dede:global.cfg_cmsurl/}/include/dedeajax2.js"></script>
<script language="javascript" type="text/javascript">
<!--
function CheckLogin(){
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 postBadGood(ftype,fid)
{
var taget_obj = document.getElementById(ftype+fid);
var saveid = GetCookie('badgoodid');
if(saveid != null)
{
var saveids = saveid.split(',');
var hasid = false;
saveid = '';
j = 1;
for(i=saveids.length-1;i>=0;i--)
{
if(saveids[i]==fid && hasid) continue;
else {
if(saveids[i]==fid && !hasid) hasid = true;
saveid += (saveid=='' ? saveids[i] : ','+saveids[i]);
j++;
if(j==10 && hasid) break;
if(j==9 && !hasid) break;
}
}
if(hasid) { alert('您刚才已表决过了喔!'); return false;}
else saveid += ','+fid;
SetCookie('badgoodid',saveid,1);
}
else
{
SetCookie('badgoodid',fid,1);
}
myajax = new DedeAjax(taget_obj,false,false,'','','');
myajax.SendGet2("{dede:field name='phpurl'/}/feedback.php?aid="+fid+"&action="+ftype+"&fid="+fid);
}
function postDigg(ftype,aid)
{
var taget_obj = document.getElementById('newdigg');
var saveid = GetCookie('diggid');
if(saveid != null)
{
var saveids = saveid.split(',');
var hasid = false;
saveid = '';
j = 1;
for(i=saveids.length-1;i>=0;i--)
{
if(saveids[i]==aid && hasid) continue;
else {
if(saveids[i]==aid && !hasid) hasid = true;
saveid += (saveid=='' ? saveids[i] : ','+saveids[i]);
j++;
if(j==20 && hasid) break;
if(j==19 && !hasid) break;
}
}
if(hasid) { alert("您已经顶过该帖,请不要重复顶帖 !"); return; }
else saveid += ','+aid;
SetCookie('diggid',saveid,1);
}
else
{
SetCookie('diggid',aid,1);
}
myajax = new DedeAjax(taget_obj,false,false,'','','');
var url = "{dede:global.cfg_phpurl/}/digg_ajax.php?action="+ftype+"&id="+aid;
myajax.SendGet2(url);
}
function getDigg(aid)
{
var taget_obj = document.getElementById('newdigg');
myajax = new DedeAjax(taget_obj,false,false,'','','');
myajax.SendGet2("{dede:global.cfg_phpurl/}/digg_ajax.php?id="+aid);
DedeXHTTP = null;
}
function check(){
if(document.formsearch.searchtype.value=="")
document.formsearch.action="http://www.google.cn/custom"
else
document.formsearch.action="{dede:field name='phpurl'/}/search.php"
}
-->
</script>
2、标签:顶一下({dede:field.goodpost/}) 踩一下({dede:field.badpost/})
3、标签后引入:<script language="javascript" type="text/javascript">getDigg({dede:field.id/});</script>
按照我说的这三步来应该是没有问题的。。再有问题问我或者看我写的关于dedecms的文章http://www.leedig.com/dedecms/ 实在不行私密我dedecms的问题,一定帮忙解决
1、头部引入js:
<script language="javascript" type="text/javascript" src="{dede:global.cfg_cmsurl/}/include/dedeajax2.js"></script>
<script language="javascript" type="text/javascript">
<!--
function CheckLogin(){
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 postBadGood(ftype,fid)
{
var taget_obj = document.getElementById(ftype+fid);
var saveid = GetCookie('badgoodid');
if(saveid != null)
{
var saveids = saveid.split(',');
var hasid = false;
saveid = '';
j = 1;
for(i=saveids.length-1;i>=0;i--)
{
if(saveids[i]==fid && hasid) continue;
else {
if(saveids[i]==fid && !hasid) hasid = true;
saveid += (saveid=='' ? saveids[i] : ','+saveids[i]);
j++;
if(j==10 && hasid) break;
if(j==9 && !hasid) break;
}
}
if(hasid) { alert('您刚才已表决过了喔!'); return false;}
else saveid += ','+fid;
SetCookie('badgoodid',saveid,1);
}
else
{
SetCookie('badgoodid',fid,1);
}
myajax = new DedeAjax(taget_obj,false,false,'','','');
myajax.SendGet2("{dede:field name='phpurl'/}/feedback.php?aid="+fid+"&action="+ftype+"&fid="+fid);
}
function postDigg(ftype,aid)
{
var taget_obj = document.getElementById('newdigg');
var saveid = GetCookie('diggid');
if(saveid != null)
{
var saveids = saveid.split(',');
var hasid = false;
saveid = '';
j = 1;
for(i=saveids.length-1;i>=0;i--)
{
if(saveids[i]==aid && hasid) continue;
else {
if(saveids[i]==aid && !hasid) hasid = true;
saveid += (saveid=='' ? saveids[i] : ','+saveids[i]);
j++;
if(j==20 && hasid) break;
if(j==19 && !hasid) break;
}
}
if(hasid) { alert("您已经顶过该帖,请不要重复顶帖 !"); return; }
else saveid += ','+aid;
SetCookie('diggid',saveid,1);
}
else
{
SetCookie('diggid',aid,1);
}
myajax = new DedeAjax(taget_obj,false,false,'','','');
var url = "{dede:global.cfg_phpurl/}/digg_ajax.php?action="+ftype+"&id="+aid;
myajax.SendGet2(url);
}
function getDigg(aid)
{
var taget_obj = document.getElementById('newdigg');
myajax = new DedeAjax(taget_obj,false,false,'','','');
myajax.SendGet2("{dede:global.cfg_phpurl/}/digg_ajax.php?id="+aid);
DedeXHTTP = null;
}
function check(){
if(document.formsearch.searchtype.value=="")
document.formsearch.action="http://www.google.cn/custom"
else
document.formsearch.action="{dede:field name='phpurl'/}/search.php"
}
-->
</script>
2、标签:顶一下({dede:field.goodpost/}) 踩一下({dede:field.badpost/})
3、标签后引入:<script language="javascript" type="text/javascript">getDigg({dede:field.id/});</script>
按照我说的这三步来应该是没有问题的。。再有问题问我或者看我写的关于dedecms的文章http://www.leedig.com/dedecms/ 实在不行私密我dedecms的问题,一定帮忙解决
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询