简体   繁体   English

单击查看按钮,没有任何反应

[英]Clicking view button and nothing happens

After clicking the VIEW button and nothing happening, I started to wonder what's wrong? 单击“查看”按钮后,什么都没有发生,我开始怀疑这是怎么回事?

GALLERIES NAME  POST    EDIT    DELETE  
Slideshow               VIEW     
SERVICES        POST    VIEW     

Code: 码:

<?php foreach ($gallery as $gallery_item): ?>
    <tr>
        <td><?php echo $gallery_item['galleries_name']; ?></td>
        <td>
            <?php if( $gallery_item['galleries_post_type'] == 'post') { echo "#"; }?>   
        </td>
        <td>
            <button type="button" class="edit" onclick="location.href = '
                <?php 
                if( $gallery_item['galleries_post_type'] == 'post') {
                    echo site_url('cpages/galleries/'.$gallery_item['galleries_id']); 
                } else {                                
                    echo site_url('cpages/viewpictures/'.$gallery_item['galleries_id']); 
                }
                ?>
            ';">VIEW</button>
        </td>

I think you should use links and describe them as button (role, type, whatsoever) and decore them with CSS. 我认为您应该使用链接并将其描述为按钮(角色,类型等),并使用CSS装饰它们。 That is: 那是:

<?php

$id = $gallery_item['galleries_id']);

?>

<td>
    <?php if ($gallery_item['galleries_post_type'] === 'post'): ?>
        <a href="<?= site_url('cpages/galleries/'.$id); ?>" class="edit">
    <?php elseif (): ?>
        <a href="<?= site_url('cpages/viewpictures/'.$id); ?>" class="edit">
    <?php endif; ?>
</td>

By searching for a better solution, I found an answer from BalusC that, I think, should solve your problem and help you understand how/what/when questions about buttons, links and so one. 通过寻找更好的解决方案,我从BalusC中找到了一个答案 ,我认为该答案应该可以解决您的问题并帮助您了解有关按钮,链接等的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM