object.insertAdjacentElement(sWhere, oElement)在一个制定的位置插入一个元素
来源:互联网 发布:mac系统清理工具 编辑:程序博客网 时间:2024/05/01 06:38
在一个临近的指定的位置插入一个元素.
语法:
oElement = object.insertAdjacentElement(sWhere, oElement)
参数:
sWhere 必需. 指出插入的位置, 用下名的值:
beforeBegin 在目标元素的外部开头位置. <i><o>..</o>
afterBegin 在目标元素的内部开头位置. <o><i>..</o>
beforeEnd 在目标元素的内部结束位置. <o>..<i></o>
afterEnd 在目标元素的外部结束位置. <o>..</o><i>
oElement 必需. 要插入的元素du.
Return Value
返回插入的元素对象.
备注
You cannot insert text while the document is loading. Wait for the onload event before attempting to call this method.
当document加载的时候,你不可以插入一个文本。在尝试调用这个方法之前,会等待载入事件结束。
If you try to insert an object that already exists on the page, the existing object will be moved to the point that you specified in the insertAdjacentElement method; no new object will be created.
如果你试图插入一个存在的对象,那么现存的对象将要移动到你指定的地方,不再重新创建一个对象。
Example
例子
This example uses the insertAdjacentElement method to add a new list item to an ol object.
HideExample
<SCRIPT>
function fnAdd()
{
var oNewItem = document.createElement("LI");
oList.children(0).insertAdjacentElement("BeforeBegin",oNewItem);
oNewItem.innerText = "List Item 0";
}
</SCRIPT>
:
<BODY>
<OL ID = "oList">
<LI>List Item 1</LI>
<LI>List Item 2</LI>
<LI>List Item 3</LI>
</OL>
<INPUT TYPE = "button" VALUE = "Add Item" onclick="fnAdd()">
</BODY>
- object.insertAdjacentElement(sWhere, oElement)在一个制定的位置插入一个元素
- insertAdjacentElement(sWhere, oElement)概要用法
- 在一个List的指定位置插入一个元素对这个List中的已有的元素顺序的影响
- 如何在用结构体在数组指定的位置插入一个元素
- vector 删除制定的一个元素
- Python:如何在字符串制定位置加入一个逗号?
- 在数组中指定的位置插入一个数.
- Java中在一个字符串的固定位置插入字符串
- 获取一个页面元素在页面上的坐标位置
- 创建一个静态链表,通过输入元素及位置插入一个元素,然后通过输入删除元素的位置删除元素。
- 在给定位置插入一个字符串
- 在升序排序的数组中插入一个元素
- 在一个环形的无重复元素的排序单向链表中插入一个元素
- 顺序表中在第i个数据元素位置上插入一个数据元素(修改)
- 在顺序表中插入一个元素
- 在一个数组任意位置插入另外一个数组
- 【链表面试题】删除无头单链表的非尾节点,插入一个元素到无头链表指定位置
- 把一个数组中的元素插入到另一个数组的指定位置
- offer
- UInx,windowes的环境配置!
- SQL Server 数据库管理常用的SQL和T-SQL语句
- FlexBuilder3beta2 +flash debug 9.0.47
- 用java程序压缩jar或war文件
- object.insertAdjacentElement(sWhere, oElement)在一个制定的位置插入一个元素
- [转]浅析cin.getline,cin.get,cin.ignore,cin.clear用法
- Sql 常用表操作
- 通过串口收发短消息(下)
- 用InstallShield 进行 ASP 软件的打包和自动安装
- Hello world
- 微软传真服务的介绍
- COBOL语言
- 《struts2权威指南》学习笔记之struts2文件上传