Jquery 문서 처리의 몇 가지 효과

4412 단어 htmljquery
Jquery 문서 처리의 몇 가지 효과

<html>
<head>
<title>File</title>
<script type='text/javascript' src="jquery/jquery-1.3.1.js"></script>
<script language="javascript">
	$(document).ready(function(){
		
		/***         ***/
		$("#SH").click(function(){
			$("#shp").append("<b>Hello</b>");
		});
		
		/***          ***/
		$("#atd").click(function(){
			$("#shp").appendTo("#atdDiv");
		});
		
		/***           ***/
		$("#atp").click(function(){
			$("#prvDiv").prepend($("#preP"));
		});
		
		/***            ***/
		$("#atpt").click(function(){
			$("#preP").prependTo($("#prvDiv"));
		});
		
		/***          ***/
		$("#aft").click(function(){
			$("#aftDiv").after($("#aftP"));
		});
		
		/***          ***/
		$("#bef").click(function(){
			$("#aftDiv").before($("#aftP"));
		});
		
		/***          ***/
		$("#wb").click(function(){
			$("#wp").wrap($("#wDiv"));
		});
		
		/***  ***/
		$("#replace").click(function(){
			$("#waitDiv").replaceWith($("#replaceDiv"));
		});
		
		/***  ***/
		$("#empty").click(function(){
			$("#emptyDiv").empty();
		});
		
		/***  ***/
		$("#remove").click(function(){
			$("#emptyDiv").remove();
		});
		
		/***  ***/
		$("#clone").click(function(){
			$("#cloneDiv").clone().insertAfter($("#cloneDiv"));
		});
	});
</script>
<body>
	
	<p id="shp">I would like to say: </p>
	<input type="button" value="Say Hello" id="SH" />
	<br><br><br>
	
	<div style="border:1px red solid" id="atdDiv">Is Nothing</div>
	<input type="button" value="add to div" id="atd" />
	<br><br><br>
	
	<div style="border:1px blue solid" id="prvDiv">Is Previous Div</div>
	<p id="preP">Is Previous P</p>
	<input type="button" value="add to previous" id="atp" />
	<input type="button" value="add to previous 2" id="atpt" />
	<br><br><br>
	
	<div style="border:1px green solid" id="aftDiv">Is A Div
	<p id="aftP">Is A P</p></div>
	<input type="button" value="add after" id="aft" />
	<input type="button" value="add before" id="bef" />
	<br><br><br>
	
	<div style="border:1px pink solid;height:10px" id="wDiv"></div>
	<p id="wp">Is A P</p>
	<input type="button" value="wrap" id="wb" />
	<br><br><br>
	
	<div style="border:1px black solid;height:10px" id="waitDiv">Waiting For Replace</div>
	<div style="border:1px red solid;height:10px" id="replaceDiv">Replaced</div>
	<input type="button" value="replace" id="replace" />
	<br><br><br>
	
	<div style="border:1px red solid;height:10px" id="emptyDiv">Waiting For Delete</div>
	<input type="button" value="empty" id="empty" />
	<input type="button" value="remove" id="remove" />
	<br><br><br>
	
	<div style="border:1px red solid;height:10px;margin-bottom:10px" id="cloneDiv">Waiting For Clone</div>
	<input type="button" value="clone" id="clone" />
	<br><br><br>
</body>
</html>

좋은 웹페이지 즐겨찾기