如何在< select>中获得全部价值 [英] How to get full value in <select>

查看:72
本文介绍了如何在< select>中获得全部价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例

< select name = username>

< option value = Borneo Sabah> Borneo Sabah< / option>

< ; / select>

Hot get / show Borneo Sabah not Borneo

example
<select name=username>
<option value=Borneo Sabah>Borneo Sabah</option>
</select>
Hot get/show Borneo Sabah not Borneo

推荐答案

放入婆罗洲沙巴内部报价:

Put Borneo Sabah inside quotes:
<select name=username>
<option value="Borneo Sabah">Borneo Sabah</option>
</select>



HTML中不需要围绕属性值的引号,但在某些情况下它们是必需的,例如当你必须在属性值中放置一个空格。




Quotes around an attribute value are not required in HTML, but they are necessary in some cases such as when you have to put a space inside your attribute value.

不带引号的属性值也必须不包含以下任何字符:



,',=,>,<或`。当然,你可以有%,或者#或£,但是没有反引号!

Unquoted attribute values must also not contain any of these characters:

", ', =, >, <, or `. Sure, you can have %, or # or £, but no backticks please!





如果你想从PHP设置属性值,你必须逃避报价 [ ^ ](使用 \):



If you want to do set the attribute value from PHP, you have to escape the quote[^] (using \"):

echo"<option value=\"".


rows [0]。 \>
rows[0]."\">".


rows [0]。 < / option>;
rows[0]."</option>";


这篇关于如何在&lt; select&gt;中获得全部价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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