HBCMS更多的中文手册参考:

add Method

DHTML文档教程

Adds an element to the areas, controlrange, or options collection.

dhtml语法

object.add(oelement [, iindex])

parameters

oElement Required. Objectthat specifies the element to add to the collection.
iIndex Optional. Integerthat specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.

Return Value

No return value.

Remarks

Before you can add an element to a collection, you must create it first by using the createelement method.

this method can be used to add elements only after the page loads.

if the method is applied inline, a run-time error occurs.

DHTML代码范例

This example uses the add method to insert an object into the options collection of a select object.

<select id="oselect">
<OPTION VALUE="1">One</OPTION>
</SELECT>
<SCRIPT>
var oOption = document.createElement("OPTION");
oSelect.options.add(oOption);
oOption.innerText = "Two";
oOption.value = "2";
</SCRIPT>

是否符合公共标准

This method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

areas, controlRange, options, SELECT

更多语法参考

remove