dpd46554 2010-07-16 19:05
浏览 108
已采纳

代码点火器:如何将这些锚标签添加到下拉菜单中?

This is probably pretty simple but I am new to this.

All I want to do is put some of the current links I have working inside a dropdown menu.

Here are the working links I would like to display in a dropdown:

<p>
<?=anchor('tasks/AddTask', 'Add a Task')?>
<?=anchor('tasks', 'All Tasks')?>
<?=anchor('tasks/mjh', 'Mike')?>
<?=anchor('tasks/ejm', 'Ed')?>
<?=anchor('tasks/fjb', 'Jan')?>
<?=anchor('tasks/ctk', 'Colin')?>
<?=anchor('tasks/cgb', 'Cindy')?>
</p>

The following does not seem to work:

<form>
<p>
Change View:
<select>
<option value="tasks">All Tasks</option>
<option value="tasks/mjh">Mike</option>
<option value="tasks/ejm">Ed</option>
</select>
<input type="submit" value="Go">
</p>
</form>

Or:

<form>
<p>
    Change View:
    <select>
    <option><?=anchor('tasks', 'All Tasks')?></option>
    <option><?=anchor('tasks/mjh', 'Mike')?></option>
    <option><?=anchor('tasks/ejm', 'Ed')?></option>
    </select>
    <input type="submit" value="Go">
</p>
</form>

Thank you.

  • 写回答

3条回答 默认 最新

  • douzi8112 2010-07-17 12:20
    关注

    Anchor tags won't work as they create full hyperlinks, and not just the URL. The following should work:

    <select id="my_links" name="my_links">
        <option value="<?php echo site_url('some/path'); ?>"><?php echo site_url('some/path'); ?</option>
    </select>
    

    Then you could use a bit of Javacsript to redirect the browser to the specified URL.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog