doutui4649 2011-08-29 21:45
浏览 74
已采纳

具有图像大小的网格/列表视图

I have problem with change images size in posts (after click on the buttons grid/list).

these are the buttons that should (after click) change $value to true or false (that scale images):

<div class="products_look">
        <input type="button" class="view_list" onclick="" value="List" />
        <input type="button" class="view_grid" onclick="" value="Grid" />
</div>

and this is the php functions that generated grid or list view in the posts:

<?php
    if($value == true) {
      echo image_products_grid();
    }
    else {
      echo image_products_list();
    }
?>

What I need to insert in onClick tags that after clicking on the button returned php $value (true or false)?

  • 写回答

1条回答 默认 最新

  • dongtong0796 2011-08-29 21:52
    关注

    Why not use a parameter in the URL? Something like this:

    <div class="products_look">
        <input type="button" class="view_list" onclick="window.location = 'display.php?type=LIST'" value="List" />
        <input type="button" class="view_grid" onclick="window.location = 'display.php?type=GRID'" value="Grid" />
    </div>
    

    And then on your PHP page:

    <?php
        if($_GET["type"] == "GRID") {
          echo image_products_grid();
        }
        else {
          echo image_products_list();
        }
    ?>
    

    Is this the type of solution that you are looking for? It's not terribly elegant, but your question is a little unclear so I hope this helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?
  • ¥15 讲解电路图,付费求解
  • ¥15 有偿请教计算电磁学的问题涉及到空间中时域UTD和FDTD算法结合的
  • ¥15 three.js添加后处理以后模型锯齿化严重