js createElement
http://www.w3schools.com/js/js_htmldom_nodes.asp
var child = document.getElementById("p1");
child.parentNode.removeChild(child);
http://www.w3schools.com/jsref/met_document_createelement.asp
var btn = document.createElement("BUTTON"); // Create a <button> element
var t = document.createTextNode("CLICK ME"); // Create a text node
btn.appendChild(t); // Append the text to <button>
document.body.appendChild(btn);
MSDN
https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
document.body.onload = addElement;
function addElement () {
// create a new div element
// and give it some content
var newDiv = document.createElement("div");
var newContent = document.createTextNode("Hi there and greetings!");
newDiv.appendChild(newContent); //add the text node to the newly created div.
// add the newly created element and its content into the DOM
var currentDiv = document.getElementById("div1");
document.body.insertBefore(newDiv, currentDiv); }
See also
js createElement的更多相关文章
- js createElement appendChild createTextNode用法
xml不支持innerHTML 1 <p id="bj">北京</p> <script type="text/javascript" ...
- js创建节点,小试牛刀
实现如下的功能 非常简单的一个小训练. 思想: 1.首先创建text和一个button 代码如下. <body> <input type="text" id=&q ...
- vue系列文章 --- 源码目录结构整理(三)
vue的版本是:^2.6.10 结构如下: |----- vue | |--- dist # 打包之后的目录vue文件 | | |--- vue.common.dev.js | | |--- vue. ...
- flutter、rn、uni-app比较
前言 每当我们评估新技术时要问的第一个问题就是“它会给我们的业务和客户带来哪些价值?”,工程师们很容易对闪闪发光的新事物着迷,却经常会忽略这些新事物其实可能对我们的客户没有任何好处,反而只会让现有的工 ...
- ReactElement源码笔记
ReactElement 源码笔记 ReactElement通过 createElement创建,调用该方法需要 传入三个参数: type config children type指代这个ReactE ...
- js 随机星星 document.createElement(); setAttribute()
js 随机星星 document.createElement(); setAttribute() <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1. ...
- JS中document.createElement()用法及注意事项
今天处理了一个日期选择器的ie和ff的兼容问题,本来这种情况就很难找错误,找了好久才把错误定位到js中创建元素的方法document.createElement(),这个方法在ie下支持这样创建元素 ...
- js 元素Dom新建并插入页面createElement
纯js var o = document.createElement('script'); o.type = 'text/template'; o.id = 'demo'; document.docu ...
- js document.createElement()的用法 (转)
document.createElement()的用法 分析代码时,发现自己的盲点--document.createElement(),冲浪一番,总结了点经验. document.createElem ...
随机推荐
- 【winform】如何在DateTimePicker中显示时分秒
1. 首先属性里面的Format属性value设置为Custom(默认为Long) 2. 对应的Custom属性value设置为yyyy-MM-dd HH:mm:ss
- php session学习笔记(实例代码)
http 无状态协议 一个服务器向客户端发送消息的时候有三条信息 一是状态二是头信息三是内容 会话控制 让一个用户访问每个页面,服务器都知道是哪个用户访问 cookie cookie是通过头信息发送 ...
- ECSHOP 支付宝发货确认接口,记录支付宝返回的交易号
1,在order_info 数据表尾添加trade_no 字段 数据表尾怎么添加trade_no 字段 ECSHOP为了支付宝发货确认接口,需要记录支付宝返回的交易号 1,在order_info 数据 ...
- wpf 制作播放视频的屏保程序、而且能分屏显示
这个程序用到了WPF里 “visual_Brush”(主要是为了实现分屏显示) , “UserControl” ,这两个知识点: 在屏保状态下播放指定文件夹下的视频,而且能分屏显示: 把编译好的屏保 ...
- 【NHibernate】配置- sql打印
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property> <pr ...
- Linq语句基础
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 滚珠菜单动效-b
原型从网上找的,动效使用了CAAnimation和UIDynamic物理引擎. gitHub :https://github.com/BearRan/FlowMenuAnimation 大致步骤如 ...
- linux学习笔记(3)-文件系统
三大类文件类型 普通文件:包括文本文件.数据文件.可执行的二进制程序文件 目录文件:linux系统把目录看成一种特殊的文件,利用它构成了文件系统的树形结构 设备文件:把设备也看成是一个文件,例如你的鼠 ...
- 1047: [HAOI2007]理想的正方形 - BZOJ
Description 有一个a*b的整数组成的矩阵,现请你从中找出一个n*n的正方形区域,使得该区域所有数中的最大值和最小值的差最小.Input 第一行为3个整数,分别表示a,b,n的值第二行至第a ...
- 你不需要jQuery(四)
jQuery是个好东西.它诞生于IE6在互联网称霸的那个时代.jQuery的存在让我们的代码能很好的兼容各种平台. 然而,到如今,浏览器技术已经取得了巨大的进步.我们可以自由的使用所有最新众多ES5/ ...