1

I have a task list.

Initially I display all of them. I want to create 2 buttons s.t. one displays the tasks ordered by date, and the other displays the tasks that have passed.

How can I do this? I don't know how to make a button to do anything else than submit. I was thinking about redirecting to another "page" but I'm not sure it is efficient.

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

or

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

But I don't know how to "catch" the event of clicking with "button"type button.

Lorena Sfăt
  • 215
  • 2
  • 7
  • 18

1 Answers1

0

In order to have a button doing something, you need some JavaScript, executing that "something":

<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

Axel Amthor
  • 10,980
  • 1
  • 25
  • 44