[英]drop down menu: how to make deactivate the 1st (selected) option?
Here is the dropdown I'm using: 这是我正在使用的下拉列表:
<form name="my_form_name">
<select name="my_ddmenu_name">
<option value="#" selected>dd menu title (should not act as a link)</option>
<option value="link to page 1">1st Link name</option>
<option value="link to page 2">2nd Link name</option>
<option value="link to page 3">3rd Link name</option>
<option value="link to page 4">4th Link name</option>
<input type="button" name="Submit" value="Go!" onClick="window.open(ddmenu1.value,'newtab')">
</select>
</form>
It's necessary for me to - have a "Go" link, as above. 对我来说,有必要 - 如上所述有一个“Go”链接。 Users should select their link of choice and then press "Go!"
用户应选择他们选择的链接,然后按“开始!” to visit the selected link.
访问所选链接。 - open links in a new tab, as above.
- 如上所示,在新标签页中打开链接。
So, how should I change the code above to deactivate the 1st (selected) option's link (currently leading to "#"). 那么,我应该如何更改上面的代码来停用第一个(选定的)选项的链接(当前通向“#”)。
Thank you. 谢谢。
尝试
<option value="#" selected disabled>dd menu title (should not act as a link)</option>
Your Go button must trigger a custom javascript that checks the value of your dropdown and then does the fancy link work. 你的Go按钮必须触发一个自定义的javascript,它会检查你的下拉列表的值,然后才能使用花哨的链接。 JQuery would be my preference.
JQuery将是我的偏好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.