|  | @@ -0,0 +1,39 @@
 | 
	
		
			
				|  |  | +<!DOCTYPE html>
 | 
	
		
			
				|  |  | +<html lang="en">
 | 
	
		
			
				|  |  | +<head>
 | 
	
		
			
				|  |  | +    <meta charset="UTF-8">
 | 
	
		
			
				|  |  | +    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
	
		
			
				|  |  | +    <title>Document</title>
 | 
	
		
			
				|  |  | +    <style>
 | 
	
		
			
				|  |  | +        .box{
 | 
	
		
			
				|  |  | +            width: 100px;
 | 
	
		
			
				|  |  | +            height: 100px;
 | 
	
		
			
				|  |  | +            background-color: red;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        .box2{
 | 
	
		
			
				|  |  | +            border:3px solid black;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        .box3{
 | 
	
		
			
				|  |  | +            margin-top: 200px;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    </style>
 | 
	
		
			
				|  |  | +</head>
 | 
	
		
			
				|  |  | +<body>
 | 
	
		
			
				|  |  | +    <!-- <div class="box box2"></div> -->
 | 
	
		
			
				|  |  | +     <div></div>
 | 
	
		
			
				|  |  | +    <script>
 | 
	
		
			
				|  |  | +        var oBox = document.getElementsByTagName("div")[0];
 | 
	
		
			
				|  |  | +        // oBox.setAttribute("class","box");
 | 
	
		
			
				|  |  | +        // 控制标签类名
 | 
	
		
			
				|  |  | +        // oBox.className = "box";
 | 
	
		
			
				|  |  | +        oBox.className = "box box2";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // var str = "box2";
 | 
	
		
			
				|  |  | +        // oBox.classList.remove("box2");
 | 
	
		
			
				|  |  | +        // oBox.classList.add("box2");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        oBox.classList.replace("box2","box3");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    </script>
 | 
	
		
			
				|  |  | +</body>
 | 
	
		
			
				|  |  | +</html>
 |