可点击的网站横幅

时间:2016-10-05 16:21:51

标签: php html web

<div class="banner-base clearfix">
    <?php 

        $bannerImages   =   $objBanner->getFields("ban_image","position","learnlink");

        foreach($bannerImages as $banner) { ?>

            <div class="banner-item">
                <span class="banner-image">
                    <a href="<?php echo $banner['learnlink']; ?>">
                        <img src="img/banner-images/<?php echo $banner['ban_image']; ?>">
                    </a>
                </span>
            </div>
    <?php }?>
</div>

我正在尝试将网站横幅设为可点击链接,但不会更改为可点击的横幅。

1 个答案:

答案 0 :(得分:0)

解决了

$bannerImages   =   $objBanner->getFields("ban_image","position","learnlink");

我将上面的行替换为下面的行

$bannerImages   =   $objBanner->getFields($table_fields,"","position");

我在div中添加了点击事件

<div class="banner-item" onclick="window.open('<?php echo $banner["learnlink"]; ?>'); return true;" style="cursor:pointer">