📄 12.6.htm
字号:
<!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>
<title>Clone Demo</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" >
</head>
<body>
<p id="p1">This is a <em>test</em> of cloning</p>
<hr>
<div id="inserthere" style="background-color: yellow;"></div>
<hr>
<script type="text/javascript">
<!--
function cloneAndCopy(nodeId, deep) //复制函数
{
var toClone = document.getElementById(nodeId); //复制
var clonedNode = toClone.cloneNode(deep); //深度复制
var insertPoint = document.getElementById('inserthere');
insertPoint.appendChild(clonedNode); //添加结点
}
//-->
</script>
<form action="#" method="get">
<form action="#" method="get">
<!—通过设置cloneAndCopy()第二个参数为true或false来控制复制的结果-->
<input type="button" value="复制"
onclick="cloneAndCopy('p1',false);" >
<input type="button" value="深度复制"
onclick="cloneAndCopy('p1',true);" >
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -