织梦模板顶一下踩一下调用方法

织梦仿站时,在内容页模板经常会用到顶一下一下调用调用方法很简单,主要就是js和dede代码,调用方法如下:

需要调用代码:

1、在<head></head>中调用js代码,如下:
<script language="javascript" type="text/javascript"

src=http://www.dede58.com/"{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;
}
-->
</script>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/5d11622010d5a34f6798c06c7e781caf.html