Home >Web Front-end >JS Tutorial >JavaScript randomly adds pictures in the first dom to the second div example_javascript skills

JavaScript randomly adds pictures in the first dom to the second div example_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:20:431269browse

JavaScript randomly adds pictures in the first dom to the second div. This code is a simple example. It extracts two random pictures from the five pictures in the first div and displays them in the second div. middle.

Copy code The code is as follows:

.org/1999/xhtml">


< title>Randomly display two pictures out of five pictures - Baidu space pictures for test pictures




The first div has five pictures




< img src="http://c.hiphotos.bdimg.com/album/s=1000;q=90/sign=b03c3e4211dfa9ecf92e521752e0cc72/d058ccbf6c81800a5b37d550b13533fa838b4799.jpg" width="200">

< img src="http:// g.hiphotos.bdimg.com/album/s=1000;q=90/sign=cb1f8fa37b899e517c8e3e147297e242/b3119313b07eca809bdd65b9912397dda0448390.jpg" width="200">
< img src="http://a.hiphotos. bdimg.com/album/s=1000;q=90/sign=fe1172bbad6eddc422e7b0fb09eb8d8c/5ab5c9ea15ce36d325dcdf6e3af33a87e850b190.jpg" width="200">

The first div image is Two random, non-repeating pictures






Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn