妈的一定要用双引号把属性给括起来!!!!
对于data直接引用 xml 文件为什么不行还不知道为什么。
select 选择控件
在HTML5中,可以通过设置multiple属性设置select控件的形式
设置了multiple后,看起来会是一个ListBox
不设置就是一个ComboBox
设置了required属性会要求必须选择一个选项
//占位符
//默认选项,可设置多个,如果没有multiple属性,会将最后一个设置了selected的option设置成默认
select . type
Returns "select-multiple
" if the element has a multiple
attribute, and "select-one
" otherwise.
select . options
Returns an HTMLOptionsCollection
of the list of options.
select . length
[ = value ]
Returns the number of elements in the list of options.
When set to a smaller number, truncates the number of option
elements in the select
.
When set to a greater number, adds new blank option
elements to the select
.
element = select . item
(index)select[index]
Returns the item with index index from the list of options. The items are sorted in tree order.
element = select . namedItem
(name)
Returns the item with ID or name
name from the list of options.
If there are multiple matching items, then a NodeList
object containing all those elements is returned.
Returns null if no element with that ID could be found.
select . add
(element [, before ])
Inserts element before the node given by before.
The before argument can be a number, in which case element is inserted before the item with that number, or an element from the list of options, in which case element is inserted before that element.
If before is omitted, null, or a number out of range, then element will be added at the end of the list.
This method will throw a HierarchyRequestError
exception if element is an ancestor of the element into which it is to be inserted.
select . selectedOptions
Returns an HTMLCollection
of the list of options that are selected.
select . selectedIndex
[ = value ]
Returns the index of the first selected item, if any, or −1 if there is no selected item.
Can be set, to change the selection.
select . value
[ = value ]
Returns the value of the first selected item, if any, or the empty string if there is no selected item.
Can be set, to change the selection.