jquery随记(DOM操作)---移动元素(添加标注、编号和连接到上下文)
2011-08-25 16:29
411 查看
**********************************************************************************
each()函数为每个都添加;
appendTo()函数为添加到;
append()函数为在后面添加;
***********************************************************************************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" type="text/css" href="Untitled-2.css" />
<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//移动元素
//$('span.footnote').insertBefore('#footer');
$('<ol id="notes"></ol>').insertAfter('div.chapter');
$('span.footnote').each(function(index){
$(this)
.before(
['<a href="#foot-note-'+(index+1)+
'" id="context-'+(index+1)+
'" class="context">',
'<sup>'+(index+1)+'</sup>',
'</a>'
].join('')
)
.appendTo('#notes')
.append(' (<a href="#context-'+(index+1)+'">context</a>)') ;
});
});
</script>
</head>
<body>
<h1 id="f-title">Flatland:A Romance of Many Dimensions</h1>
<div id="f-author">by Edwin A.Abbott</div>
<h2>Part 1,Section 3</h2>
<h3 id="f-subtitle">
Concerning the Inhabitants of Flatland
</h3>
<div id="excerpt">an excerpt</div>
<div class="chapter">
<p class="square">Our Professional Men and Gentlemen are
Squares (to which class I myself belong) and Five-Sided
Figures or
<a href="http://en.wikipedia.org/wiki/Pentagon">Pentagons</a>
</p>
<p class="nobility hexagon">Next above these come the
Nobility,of whom there are several degrees,beginning at
Six-Sided Figures ,or <a href="http://en.wikipedia.org/wiki/Hexagon">Hexagons</a>
and from thence rising in the number of their sides till
they receive the honourable title of
<a href="http://en.wikipedia.org/wiki/Circle">circle</a> ,he is included in the
Circular or Priestly order;and this is the highest class of all.
</p>
<p><span class="pull-quote"> It is a <span class="drop">Law of Nature</span>
with us that a male child shall have
<strong> one more side </strong> than his father </span>,so
that each generation shall rise (as a rule) one step in
the scale of development and nobility.Thus the son of a
Square is a Pentagon ;the son of a Pentagon, a Hexagon;
and so on.
</p>
<p>Our Professional Men and Gentlemen are
Squares (to which class I myself belong) and Five-Sided
Figures or
<a href="http://en.wikipedia.org/wiki/Pentagon">Pentagons1</a>
</p>
<p> Rarely—in proportion to the vast numbers of Isosceles
births—is a genuine and certifiable Equal-Sided
Triangle produced from Isosceles parents.
<span class="footnote"> "What need of a certificate?" a Spaceland
critic may ask:"Is no t the procreation of a Square Son a
certificate from Nature herself,proving the Equalsidedness
of the Father?" I reply that no Lady of any position will
marry an uncertified Triangle. Qquare offspring has
sometimes resulted from a slightly Irregular Triangle;
but in almost every such case the Irregularity of the
first generation is visited on the third ;which either
fails to attain the Pentagonal rank, or relapses to the Triangular,</span>
Such a birth requires, as its antecedents ,not also a long-continued exercise of
frugality and self-control on the part of the would-be
ancestors of the coming Equilateral,and a patient,
systematic,and continuous development of the Isosceles in tellect through many
generations.
</p>
<p>The birth of a True Equilateral Triangle from Isosceles
parents is the subject of rejoicing in our country for many
furlongs round.After a strict examination conducted by the
Sanitary and Social Board,the infant, if certified as
Regular.is with solemn ceremonial admitted into the class
of Equilaterals.He is then immediately taken from his
proun yet sorroing parents and adopted by some childless
Equilateral.<span class="footnote">The Equilateral is
bound by oath never to permit the child henceforth to enter
his former home or so much as to look upon his relations
again, for fear lest the freshly developed organism may,by
force of unconscious imitation ,fall back again into his
hereditary level.</span>
</p>
<p>How admirable is the Law of Compensation!
<span class="footnote">And how perfect a proof of the natural
fitness and,I may almost say,the divine origin of the
aristocratic constitution of the States of Flatland!</span>
By a judicious use of this Law of Nature,the Polygons and
Circles are almost always able to stifle sedition in its
very cradle,taking advantage of the irrepressible and
boundless hopefulness of the human mind.…
</p>
<div id="footer">
</div>
</body>
</html>
each()函数为每个都添加;
appendTo()函数为添加到;
append()函数为在后面添加;
***********************************************************************************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" type="text/css" href="Untitled-2.css" />
<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//移动元素
//$('span.footnote').insertBefore('#footer');
$('<ol id="notes"></ol>').insertAfter('div.chapter');
$('span.footnote').each(function(index){
$(this)
.before(
['<a href="#foot-note-'+(index+1)+
'" id="context-'+(index+1)+
'" class="context">',
'<sup>'+(index+1)+'</sup>',
'</a>'
].join('')
)
.appendTo('#notes')
.append(' (<a href="#context-'+(index+1)+'">context</a>)') ;
});
});
</script>
</head>
<body>
<h1 id="f-title">Flatland:A Romance of Many Dimensions</h1>
<div id="f-author">by Edwin A.Abbott</div>
<h2>Part 1,Section 3</h2>
<h3 id="f-subtitle">
Concerning the Inhabitants of Flatland
</h3>
<div id="excerpt">an excerpt</div>
<div class="chapter">
<p class="square">Our Professional Men and Gentlemen are
Squares (to which class I myself belong) and Five-Sided
Figures or
<a href="http://en.wikipedia.org/wiki/Pentagon">Pentagons</a>
</p>
<p class="nobility hexagon">Next above these come the
Nobility,of whom there are several degrees,beginning at
Six-Sided Figures ,or <a href="http://en.wikipedia.org/wiki/Hexagon">Hexagons</a>
and from thence rising in the number of their sides till
they receive the honourable title of
<a href="http://en.wikipedia.org/wiki/Circle">circle</a> ,he is included in the
Circular or Priestly order;and this is the highest class of all.
</p>
<p><span class="pull-quote"> It is a <span class="drop">Law of Nature</span>
with us that a male child shall have
<strong> one more side </strong> than his father </span>,so
that each generation shall rise (as a rule) one step in
the scale of development and nobility.Thus the son of a
Square is a Pentagon ;the son of a Pentagon, a Hexagon;
and so on.
</p>
<p>Our Professional Men and Gentlemen are
Squares (to which class I myself belong) and Five-Sided
Figures or
<a href="http://en.wikipedia.org/wiki/Pentagon">Pentagons1</a>
</p>
<p> Rarely—in proportion to the vast numbers of Isosceles
births—is a genuine and certifiable Equal-Sided
Triangle produced from Isosceles parents.
<span class="footnote"> "What need of a certificate?" a Spaceland
critic may ask:"Is no t the procreation of a Square Son a
certificate from Nature herself,proving the Equalsidedness
of the Father?" I reply that no Lady of any position will
marry an uncertified Triangle. Qquare offspring has
sometimes resulted from a slightly Irregular Triangle;
but in almost every such case the Irregularity of the
first generation is visited on the third ;which either
fails to attain the Pentagonal rank, or relapses to the Triangular,</span>
Such a birth requires, as its antecedents ,not also a long-continued exercise of
frugality and self-control on the part of the would-be
ancestors of the coming Equilateral,and a patient,
systematic,and continuous development of the Isosceles in tellect through many
generations.
</p>
<p>The birth of a True Equilateral Triangle from Isosceles
parents is the subject of rejoicing in our country for many
furlongs round.After a strict examination conducted by the
Sanitary and Social Board,the infant, if certified as
Regular.is with solemn ceremonial admitted into the class
of Equilaterals.He is then immediately taken from his
proun yet sorroing parents and adopted by some childless
Equilateral.<span class="footnote">The Equilateral is
bound by oath never to permit the child henceforth to enter
his former home or so much as to look upon his relations
again, for fear lest the freshly developed organism may,by
force of unconscious imitation ,fall back again into his
hereditary level.</span>
</p>
<p>How admirable is the Law of Compensation!
<span class="footnote">And how perfect a proof of the natural
fitness and,I may almost say,the divine origin of the
aristocratic constitution of the States of Flatland!</span>
By a judicious use of this Law of Nature,the Polygons and
Circles are almost always able to stifle sedition in its
very cradle,taking advantage of the irrepressible and
boundless hopefulness of the human mind.…
</p>
<div id="footer">
</div>
</body>
</html>
相关文章推荐
- learning jQuery 学习笔记十一(+jQuery 1.4.1 API)-- DOM操作-基于命令改变页面 ----移动元素
- DOM操作——JavaScript怎样添加、移除、移动、复制、创建和查找节点
- JS的DOM操作元素示例1--删除添加元素
- PHP DOM操作xml文档,添加元素,添加元素属性
- DOM操作——怎样添加、移除、移动、复制、创建和查找节点
- jquery随记(DOM操作)---包装元素
- 10014---jQuery--jQuery DOM 操作-添加元素
- 第5天(就业班) BOM、window对象、事件、location对象、screen对象、Dom编程根据属性找节点、通过关系找节点、添加附件、联动框、操作元素的css样式、正则表达式
- DOM操作:创建、添加、移除、移动、和查找
- jQuery的DOM操作之添加元素和删除元素
- DOM操作——怎样添加、移除、移动、复制、创建和查找节点。
- Jquery each() 如何操作动态添加的DOM元素
- DOM操作——怎样添加、移除、移动、复制、创建和查找节点
- DOM操作——添加、移除、移动、复制、创建和查找节点
- VS2008:无法执行添加/移动操作,代码元素是只读的
- DOM操作 如何添加、移除、移动、复制、创建和查找节点等
- 无法执行添加/移动操作,因为代码元素CConfigDlg是只读的
- DOM操作——怎样添加、移除、移动、复制、创建和查找节点
- DOM高级应用——表格元素的添加、删除、搜索操作1
- javascript 原生方法对dom节点的操作,创建、添加、删除、替换、插入、复制、移动等操作