dedecms利用js点击图片翻页

发表于 2019-08-02   |   分类于 dedecms
<script language="javascript" type="text/javascript">
var shortname = "{dede:global.art_shortname/}";
var npage = {dede:field name='nowpage'/};
var totalpage = {dede:field name='totalpage'/};
var namehand = '{dede:field name='namehand'/}';
var displaytype = '{dede:field name='displaytype'/}';
var gtimer = null;
function pageOpenEnd(){
    var nexturl = "/{dede:prenext get='pro' runphp="yes"}   
preg_match_all('/(\d+)/sim', @me, $strResult, PREG_PATTERN_ORDER);   
@me=$strResult[1][0];
{/dede:prenext}.html";
    if( nexturl != '' ){
        window.location = nexturl;
    }else{
        window.location="/";
    }
}
//下一张
function dPlayNext()
{
    if(npage==totalpage) { 
    pageOpenEnd(); 
    }
    else
    {
        if(displaytype=='st' && namehand!='') location.href = namehand+"_"+(npage+1)+shortname;
        else location.href = "/{dede:field name='id'/}-"+(npage+1)+".html";
    }
}
</script>

然后给图片地址套上点击事件

<a href="javascript:dPlayNext();">{dede:field.body/}</a>
© 2019 Powered by Typecho & Theme Quark