HTML选择标记可以使用隐藏文本输入吗? [英] Can HTML Select Tag work with Hidden Text Input?

查看:106
本文介绍了HTML选择标记可以使用隐藏文本输入吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定选择标记是否可以像这样使用隐藏文本输入:

 < SELECT NAME =测试> 
< OPTION VALUE =1> One< / option>
< input type =hiddenvalue =helloname =Testing>
< OPTION VALUE =2>两个< / option>
< input type =hiddenvalue =worldname =Testing>
< / SELECT>

有什么想法?

解决方案

 < form> 
< input type =hiddenvalue =helloname =Testing>
< input type =hiddenvalue =worldname =Testing>
< SELECT NAME =测试>
< OPTION VALUE =1> One< / option>
< OPTION VALUE =2>两个< / option>
< / SELECT>
< / form>

现在从你的代码判断,看起来你想要Testing = hello,如果选择了第一个选项,如果选择第二个选项,测试=世界。在这种情况下,请这样做:

 < SELECT NAME =Testing> 
< OPTION VALUE =hello> One< / option>
< OPTION VALUE =world>两个< / option>
< / SELECT>


I am not sure if Select Tag can work with Hidden Text Input like this:

<SELECT NAME="Testing">  
  <OPTION VALUE="1"> One </option> 
  <input type="hidden" value="hello" name="Testing">
  <OPTION VALUE="2"> Two </option>
  <input type="hidden" value="world" name="Testing">   
</SELECT>

Any ideas?

解决方案

That won't work, but this will:

<form>
<input type="hidden" value="hello" name="Testing">
<input type="hidden" value="world" name="Testing">   
<SELECT NAME="Testing">  
  <OPTION VALUE="1"> One </option> 
  <OPTION VALUE="2"> Two </option>
</SELECT>
</form>

Now judging from your code, it looks like you want Testing=hello if the first option is selected and Testing=world if the second option is selected. In that case, do it like this:

<SELECT NAME="Testing">  
  <OPTION VALUE="hello"> One </option> 
  <OPTION VALUE="world"> Two </option>
</SELECT>

这篇关于HTML选择标记可以使用隐藏文本输入吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆