JavaScriptはページの動的な追加画像を実現します.

563 ワード




	
	Document


	
	
		window.onload = function(){
			document.body.addEventListener('click', function () {
     			 var myParent = document.getElementById("Banner"); 
     			 var myImage = document.createElement("img");
			     myImage.src = 'https://thecatapi.com/api/images/get?format=src&type=gif';
			     myParent.appendChild(myImage);
			     myImage.style.marginLeft = "160px";
			});
		}