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 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。