问题描述
示例
< 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
推荐答案
<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=\"".
这篇关于如何在< select>中获得全部价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!