代码如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <script language="javascript"> window.onload = function () { var tp = document.getElementById("tupian"); var imgx = document.getElementsByTagName("img")[0]; tp.innerHTML = "<img src='"+imgx.src+"'/>"; } </script> </head> <body> <img src="f1.JPG" width="229px" height="156px" /> <img src="f2.JPG" width="229px" height="156px" /> <img src="f3.JPG" width="229px" height="156px" /> <img src="f4.JPG" width="229px" height="156px" /> <img src="f5.JPG" width="229px" height="156px" /> <div id="imgsr"></div> <div id="imgsrc" style="display:none"> <li><img src="f2.jpg" width="229px" height="156px" ></li> <li><img src="f3.jpg" width="229px" height="156px" ></li> </div> <script language="javascript"> function showImg() { document.getElementById("imgsr").innerHTML=document.getElementById("imgsrc").innerHTML; } showImg(); </script> <div id="tupian"></div> </body> </html>