zoukankan      html  css  js  c++  java
  • 对网页图片的增删改管理

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="UTF-8">
    		<title></title>
    		<marquee>增加修改删除图片</marquee>
    		<script type="text/javascript">
    			function addpicture(){
    				var v1 = document.createElement("img");
    				v1.src = "../../img/img/3.jpg";
    				document.getElementById("div1").insertBefore(v1,document.getElementById("p1"));				
    			}
    			function modifypicture(){
    				
    				var v3 = document.getElementById("div1");//获取父类容器
    				var arr1 =document.getElementsByTagName("img");
    				if(arr1.length>0){
    					var v4 =document.createElement("img");
    					v4.src ="../../img/img/2.jpg";
    					v3.replaceChild(v4,arr1[arr1.length-1]);
    					
    				}else{
    					alert("wrong");
    				}
    				
    			}
    			function deletepicture(){
    				var v3 = document.getElementById("div1");
    				var arr2 = document.getElementsByTagName("img");
    				if(arr2.length>0){
    					v3.removeChild(arr2[arr2.length-1]);
    				}else{
    					alert("wrong");
    				}
    			}
    		</script>
    	</head>
    	<body>
    		<div id="div1">
    			
    			<input type="button" name="btn1" id="btn1" value="add" onclick="addpicture()"/>
    			<input type="button" name="btn2" id="btn2" value="modify" onclick="modifypicture()"/>
    			<input type="button" name="btn3" id="btn3" value="delete" onclick="deletepicture()"/>
    			
    			<p id="p1"></p>
    		</div>
    	</body>
    </html>
    
  • 相关阅读:
    线程包含CPU现场
    K8S资源操作
    Kubernetes资源管理
    kubernetes部署安装
    kubernetes简介
    Docker总结
    3.11 虚拟局域网
    3.10 以太网交换机生成树协议STP
    3.9 以太网交换机自学习和转发帧的流程
    3.8 集线器与交换机的区别
  • 原文地址:https://www.cnblogs.com/kiskistian/p/7419801.html
Copyright © 2011-2022 走看看