【问题标题】:HTML & php buttons custom display informationHTML & php 按钮自定义显示信息
【发布时间】:2014-12-27 18:09:26
【问题描述】:

我有一个任务列表。

最初我会显示所有这些。我想创建 2 个按钮 s.t.一个显示按日期排序的任务,另一个显示已通过的任务。

我该怎么做?我不知道如何制作一个按钮来做除了提交之外的任何事情。 我正在考虑重定向到另一个“页面”,但我不确定它是否有效。

<button type="button" name = 'display1' value="orderedDisplay">Order by date</button>
<button type="button" name = 'display2' value="passedTasks">Passed tasks</button>

            <table >
                <tr>
                    <a href="orderedbydate.php">Order by date</a>
                </tr>
                <tr>
                    <a href="pastevents.php">Display past events</a>
                </tr>
            </table>

但我不知道如何“捕捉”点击“按钮”类型按钮的事件。

【问题讨论】:

标签: php html button


【解决方案1】:

为了让按钮做某事,你需要一些 JavaScript 来执行那个“某事”:

<input type="button" name='display1' 
       onclick="callOrderByDate()" value="Order by date"/>


....
<script type="text/javascript">
   function callOrderByDate()
   {
        alert("I'm not ging to write the entire code here...");
   }
 ...
 </script>

sample

【讨论】:

    猜你喜欢
    • 2012-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多