Browser image function (dynamic)

Source: Internet
Author: User

<! 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.