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 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作