insertbefore,insertbefore on node
js中AppendChild与insertBefore的用法详细解析
appendChild定义
appendChild(newChild:
Node)
:
Node
Appends
a
node
to
the
childNodes
array
for
the
node.
Supported:
IE
5.0+,
Mozilla
1.0+,
Netscape
6.0+,
Safari
1.0+,
Opera
7.0+
添加一个节点到指定的节点的子节点数组中,读起来好象有点拗口,简单地说就是将元素添加到指定的节点中
appendChild用法
target.appendChild(newChild)
newChild作为target的子节点插入最后的一子节点之后
appendChild例子
var
newElement
=
document.Document.createElement('label');
newElement.Element.setAttribute('value',
'Username:');
var
usernameText
=
document.Document.getElementById('username');
usernameText.appendChild(newElement);
insertBefore定义
The
insertBefore()
method
inserts
a
new
child
node
before
an
existing
child
node.
insertBefore()
方法的作用是:在现有的子节点前插入一个新的子节点
insertBefore用法
target.insertBefore(newChild,existingChild)
newChild作为target的子节点插入到existingChild节点之前
existingChild为可选项参数,当为null时其效果与appendChild一样
insertBefore例子
var
oTest
=
document.getElementById("test");
var
newNode
=
document.createElement("p");
newNode.innerHTML
=
"This
is
a
test";
oTest.insertBefore(newNode,oTest.childNodes[0]);
好了那么有insertBefore的应该也有insertAfter吧?
好那我们来用Aptana编写一个例子吧,但Aptana的智能提示告诉我其实没有insertAfter这个方法
那么就自己定义一个罗:)
insertAfter定义
function
insertAfter(newEl,
targetEl)
{
var
parentEl
=
targetEl.parentNode;
if(parentEl.lastChild
==
targetEl)
{
parentEl.appendChild(newEl);
}else
{
parentEl.insertBefore(newEl,targetEl.nextSibling);
}
}
insertAfter用法与例子
var
txtName
=
document.getElementById("txtName");
var
htmlSpan
=
document.createElement("span");
htmlSpan.innerHTML
=
"This
is
a
test";
insertAfter(htmlSpan,txtName);
将htmlSpan
作为txtName
的兄弟节点插入到txtName
节点之后
总结:
1、appendChild和insertBefore是做对节点的方法来使用的,而insertAfter只是自定义的一个函数
2、insertBefore相对于appendChild来说,比较灵活可以将新的节点插入到目标节点子节点数组中的任一位置。
3、使用appendChild和insertBefore来插入新的节点前提是,其兄弟节点必须有共同的父节点
vue报错解决-"NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before
在使用vue的时候,我们因为改变了页面的DOM结构,可能会遇见这样的告警信息,并且页面会被卡主,需要刷新才可以解决;但是,在实际项目中,这样的情况肯定是不允许出现的。错误告警如下:
vue框架中提供了v-if 和 v-show两个指令,用于控制页面不DOM结构的显隐性。
简单来讲,使用v-show代替v-if即可。经验证,添加结构不会再出现该报错,如图:
因实际开发中,遇见了该问题,参考博友 琥珀光洁-衍钧 的博客解决,本人结合自己的理解重新整理一下。
博客链接:

improve的用法和短语例句中文意思是什么
我们在 学习英语 的时候,经常会看到improve这个单词,如果不了解improve的意思和用法,会很容易出错,那么improve的用法有哪些?下面是我给大家带来的improve的用法和 短语 例句_improve的中文意思是什么,以供大家参考!
▼ improve的用法
improve的用法1:improve的基本意思为“改善,提高”,可指健康状况、环境、形势等,也可指具体事物,还可间或指人。强调部分地或某种程度上对客体加以修补改正,以提高到较高水平或使其更受欢迎。本词不用于坏的事物变好,也不用于变得十分完美,无以复加。
improve的用法2:improve用作及物动词时可接名词或代词作宾语,但不用于被动结构; 用作不及物动词时主动形式常含有被动意义。
improve的用法3:improve后常接反身代词表示“在知识或学问上有进步”,其后常接介词in。
improve的用法4:improve常和表示程度的副词连用。
▼ improve的常用短语
用作动词 (v.)
improve in (v.+prep.)
improve on〔upon〕 (v.+prep.)
▼ improve的词汇辨析
improve,better,perfect,refine
这些动词均有“改进,改善”之意。
improve 最常用词,多指状态或性质上的深刻或重要改进,也可指自身能力的提高。
better 多用于口语,指适当地改善原来并非很差的状态或性质,也指社会地位、经济状况的改善。
perfect 语义强,通常指使 方法 、技术等达到完善美好的境地。
refine 侧重指使语言、仪态等变得文雅、优美,也可指技艺等的提高。
▼ improve的用法例句
1. You can improve your chances of profit by sensible planning.
你可以通过合理计划来提高盈利的机会。
2. Massage is used to relax muscles, relieve stress and improve the circulation.
按摩可以使肌肉放松,缓解压力和促进血液循环。
3. To improve hand-eye co-ordination, practise throwing and catching balls.
要想提高手眼协调能力,就练习投球和接球。
4. Lights clipped onto life jackets improve the chances of rescue.
别在救生衣上的灯提高了获救可能性。
5. As soon as relations improve they will be allowed to go.
一旦关系有所改善,他们就可以获准离开。
6. How can faculty improve their teaching so as to encourage creativity?
教师们如何才能改进教学以激发创造性呢?
7. Exercising the body does a great deal to improve one's health.
锻炼身体对增进健康大有益处。
8. The tobacco industry has been trying to improve its image.
烟草行业一直在试图改善其形象。
9. He says he wants to improve the tarnished image of his country.
他说他想改善自己国家受损的形象。
10. Opportunities will improve as the company expands domestically and internationally.
随着国内业务和国际业务的扩展,该公司将获得更好的机会。
11. He said he was going to improve his football.
他说他要提高 足球 技术。
12. People have been waiting impatiently for a chance to improve the situation.
人们一直在焦急地等待使形势出现转机的机会。
13. No amount of tinkering is going to improve matters.
任何小修小补都是于事无补的。
14. The president wants to improve the nation's highways and mass transit systems.
总统希望改善该国的公路与公共交通系统。
15. This will improve your performance and help you burn off calories.
这将会改善你的表现,并帮你消耗卡路里。
improve的用法相关 文章 :
★ interest的用法和短语例句
★ improve的用法和短语例句中文意思是什么
★ influence的用法和例句
★ better的用法和短语例句意思是什么
★ 人教版初三英语UNIT4测试试卷及答案(2)
★ 九年级英语上学期期末考试试卷
★ therefore的用法和例句辨析
★ better的用法和短语例句意思是什么
★ 高考英语写作技巧汇总
var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = ""; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();
document.body.insertBefore是什么意思?
document.body.insertBefore(a,b);的意思是在b的前面插入a
document.body.insertBefore(document.createElement("div"), document.body.childNodes[0]);
的意思是在document.body.childNodes[0]前面插入一个新的div
寄托的意思是什么
在语文中,相信大家用过“寄托”这个词,那么“寄托”的意思是什么呢?用“寄托”怎么进行 造句 呢?可以互相分享一下哦!下面是我给大家带来的寄托的意思是什么_寄托的英文解释,以供大家参考,我们一起来看看吧!
▼ 寄托的意思是什么
寄托,本意是心灵的某种依靠,即在人郁闷、伤心、迷茫的时候需要安慰,却找不到身边真实的依靠时,心中那不切实际的,幻想的依靠 寄托是一种源自于精神层面本能的需求,是将负面情绪疏导至被寄托处,以缓解内心感到的不安。可以说这是一种给精神的药剂。 相对而言,有精神寄托的人更少会对生存状态感到迷茫,心底更踏实,因而更有利于人们获得相对高效率高品质的生活。
▼ 寄托的英文解释
entrust to the care of sb.;leave with sb.;place on;find sustenance in;bailment ;
[entrust to the care of sb.;leave with]∶委托别人照料
寄托侍者。--唐. 李朝威《柳毅传》
寄托孩子给别人看带
[place hope on]∶寄理想、情感于某人或某事物上
托身,安身 [settled place for life;take shelter;settle down]
无可寄托。--《荀子.劝学》
▼ 寄托的相关出处
寄托侍者。——唐·李朝威《柳毅传》
寄托孩子给别人看带。
寄理想、情感于某人或某事物上
托身,安身
无可寄托。——《荀子·劝学》
▼ 寄托的中英例句
看涨石油者将希望寄托在数据上。
Oil bulls are hitching their wagon to data.
他得到寄托自己的耳朵,他没有讨论他的其余部分?
He's getting his ears pinned, and he didn't discuss the rest of him?
欧元的生死存亡可能就寄托在上面了。
The euro's survival may yet depend on it.
母亲们可能会把不切实际、有时甚至是自相矛盾的期望寄托在女儿身上。
Mothers may place unrealistic and at times conflicting expectations on their daughters.
▼ 用寄托如何造句
1.这小小的一方领巾,承载着老一辈革命家对我们的嘱托,寄托了家长和老师对我们的期望。
2.他们把希望寄托于当地卫生和研究的领导人,而后者又向这个年度论坛的专家寻求指导。
3.你们就把计划的全部希望都寄托在那辆 老破车 上?
4.我想,许多不好的经理也会把这些不切实际的期望寄托在他们的团队上。
5.即使奥巴马在将信任寄托在“新中国”的身上,似乎世界上许多人并不和他一样具有这种信任。
6.是上帝给我们创造的这些情境的,至少我这么认为。你要把信仰寄托于对上帝的认同而非上帝的作为上。
7.这情感可以依附于一座教堂,一个班级,或者仅仅表现在消极的一面,反对着这些那些,不需要一个积极的具体事物来寄托忠诚。
8.温家宝说,我们把中国经济的未来寄托在科技发展、特别是包括生物技术和生命科学在内的高新技术上。
9.正因为如此,才会有人觉得,我们不应该把解决问题的希望寄托在那些制造问题的人身上。
10.还有另一个更阴险,与所有你对运动生化需氧量的寄托和假日问题的希望。
11.就目前而言,他是所有人的希望和寄托所在。
12.你的全部未来寄托在这次考试上。
13.真正的爱可以为了一只失去的手套或一条找到的手帕而懊恼,而陶醉,并且需要永恒来寄托它的忠诚和希望。
14.我在书本中找到我需要的寄托,几乎从小就是如此。
15.其希望寄托于企业增加预算,寄托于员工对其服务的公司如何为全社会做贡献的兴趣越来越浓厚。
16.除了尝试唤起球队的勇气外,湖人队和他们的忠实球迷们还将他们所有的希望都寄托到了身高7英尺、年仅21岁的中锋拜纳姆回归身上。
17.可是那内心的苦楚又有谁会懂呢,我只有寄托在这虚无的网络,就像夜晚的宇宙苍茫无际,而我就是那颗寻找月亮的星。
18.虽然他没有这么说出来,但是他将他的希望寄托在由无数个基辛格呈献的国家协奏曲。
19.她最后的希望完全寄托在丈夫身上。
20.她把最后的希望寄托在丈夫身上。
寄托的意思相关 文章 :
★ 寄托的意思是什么
★ 寄托的意思和造句
★ 寄托词语的意思解释
★ 寄托的词语解释及造句
★ 托词的意思是什么
★ 嬉戏的意思是什么
★ 用寄托造句
★ 象征的意思是什么
★ 春节的含义是什么
★ 百无一用是什么意思
var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = ""; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();
设计用英语怎么说
在英语中,我们经常会用到设计,但是很多人不知道设计怎么翻译,其实设计有几种说法,那么你了解多少呢?下面是我给大家带来的设计用英语怎么说_设计的英语例句,以供大家参考,我们一起来看看吧!
▼ 设计的英语说法
1:
design
2:
plan
3:
devise
▼ design的 短语
interior design
室内设计
by design
有计划地;有意地
course design
课程设计
graphic design
装帧设计艺术
intelligent design
智慧设计理论
argument from design
宇宙设计论论证
design and implementation
设计和执行;设计和实施;设计和落实
design for
为…设计
structural design
结构设计;构造设计;结构性设计
engineering design
工程设计;工程设计学;工艺设计
product design
产品设计
design process
设计过程;设计工艺;设计流程
design scheme
设计方案
architectural design
建筑设计
design requirements
设计要求;设计的要求
design concept
设计理念;设计观念;设计概念
conceptual design
概念设计;方案设计
industrial design
工业设计;产业设计;工业产品设计
overall design
整体设计;总体设计;总设计
building design
建筑物设计;建筑设计
▼ 设计的英语例句
他设计了一种把每句话进行独特编码的 方法 。
He devised a way of coding every statement uniquely.
她的设计十分新颖。
Her designs have great originality.
工程师们设计一台新机器。
The engineers projected a new machine.
我们并不是要设计一个现代乌托邦。
We weren't out to design a contemporary utopia.
他请我建造并设计该饭店。
He approached me to create and design the restaurant.
我们将了解到门罗重新设计诸多核心管理模式的细节。
And we 'll get into the details of Menlo' s redesign of so many core management practices.
我们在设计新厨房。
We are planning a new kitchen.
这件衣服是最新设计。
This dress is of the latest design.
她是工业设计师。
She is an industrial designer.
体验性旅游项目设计包括纵向深度设计和横向整合设计。
Experience tour item design is the core and sprit of tour site planning.
本结构设计是以建筑设计图为基础进行设计的。
The structural design is based on architectural design of the map.
这里的版式设计成功地向人们展示了平面设计这一专业所独有的表达语言,是 其它 视觉设计所不能代替的。
This logo is a great example for the expressive language of graphic design.
模糊可靠性设计是机械设计领域中一种较为先进的设计方法。
The fuzzy reliability design is a more advanced method in the mechanical design.
她穿着纽约杰出设计师设计的服装。
She was dressed by a leading New York designer.
建立了自顶向下的设计模式与导航设计机制,实现了模具设计过程的数据管理。
Data of decor mold design can be managed effectively.
他的水彩设计使许多图书大为生色。
His watercolour designs adorn a wide range of books.
展览涵盖20世纪的各种设计。
The show runs the gamut of 20th century design.
七八十年代轮廓清晰的线条设计
The sharp, linear designs of the Seventies and Eighties
首家专为艾滋病人设计的疗养院
The first nursing home designed specifically for people with AIDS
大多数移动机器人仍处在设计阶段。
Most mobile robots are still in the design stage.
设计英语相关 文章 :
★ 设计用英语怎么说
★ 设计师用英语怎么说
★ 设计理念用英语怎么说
★ 艺术设计英语怎么说
★ 设计方案用英语怎么说
★ 教学设计用英语怎么说
★ 程序设计英语怎么说
★ 园林设计英语怎么说
★ 创意用英语怎么说
★ 简介用英语怎么说
var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = ""; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();