Jquery 快速学(二:Dom 操作)
Dom 操作即对整个 html 文档的灵活操作。通过强悍的选择器来达到我们的目
的。
Html 初始结构:
<p>Jquery 快速学之二 Dom 操作</p>
<img src="image/edit.gif" class="Img"/>
<table cellspacing="0" id="myTable">
<tr>
<td colspan="2">我的教学好不好</td>
</tr>
<tr>
<td>很好</td>
<td>非常好</td>
</tr>
<tr>
<td id="superGoods">超级好</td>
<td>无敌好</td>
</tr>
<tr>
<td>一级好</td>
<td>好好好!</td>
</tr>
</table>
<input type="button" value="创建一个段落" id="btnClearP"/>
<input type="button" value="创建一行" id="btnClearNodes"/>
<input type="button" value="移动一行" id="btnMove"/>
<input type="button" value="删除节点" id="btnRemove"/>
<br />
<input type="button" value="复制节点" id="btnCopy"/>
<input type="button" value="替换节点" id="replace"/>
<input type="button" value="包裹节点" id="wrap"/>
<br />
<input type="button" value="设置 img 元素的属性 Src" id="setSrc"/>
<input type="button" value="删除 img 元素的属性 Src" id="DeleteSrc"/>
<input type="button" value="获取 img 元素的属性 Src" id="getSrc"/>
<br />
<input type="button" value="获取 class 类" id="getClass"/>
<input type="button" value="设置 class 类" id="setClass"/>
<input type="button" value="追加样式" id="superaddition"/>
<input type="button" value="删除全部样式" id="deleteStyle"/>
<input type="button" value="删除指定样式" id="deleteAppoint"/>
<input type="button" value="重复切换样式" id="repeatStyle"/>