<! DOCTYPE html/> // This is the prefix of html5, other formats can also be used, but without the dtd protocol, the page layout will be messy // The difference between the two operations is that you need to repeatedly Delete and add function ShowFolderFileLists () {pathArray = new Array (); pathArray. push ("image/1.jpg"); pathArray. push ("image/2.jpg"); pathArray. push ("image/2.jpg"); pathArray. push ("image/3.jpg"); pathArray. push ("image/3.jpg"); pathArray. push ("image/4.jpg"); pathArray. push ("image/4.jpg"); pathArray. push ("image/5.jpg"); pathArray. push ("image/5.jpg"); pathArray. push ("image/6.jpg"); ge TImage ();} function getImage () {try {// Delete the element control document. getElementById ("partend "). removeChild (document. getElementById ("List1"); var divParents = document. createElement ("div"); divParents. setAttribute ("id", "List1"); // Add the element control document. getElementById ("partend "). appendChild (divParents); for (var I = 0; I <pathArray. length; I ++) {// create div var divParent = document. createElement ("div"); divParent. se TAttribute ("id", I); divParent. setAttribute ("class", "pic"); document. getElementById ("List1 "). appendChild (divParent); // create the image control var images = document. createElement ("img"); images. setAttribute ("src", pathArray [I]. toString (); images. setAttribute ("width", "109"); images. setAttribute ("height", "87"); images. setAttribute ("alt", "logo"); document. getElementById (I ). appendChild (images) ;}} catch (err) {Lert (err. description) ;}</script>
:
Some information on the Internet has been sorted out to achieve the desired effect! Write down and use it later.