<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %><%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><html> <head> </head> <script> function GetXMLNodeValue(url)...{ var dom = new ActiveXObject("Microsoft.XMLDOM") ; dom.async=false ; dom.load(url) cadPhoto = dom.getElementsByTagName("cadPhoto"); //֢oˇͼƬµŃ� resultDiv = document.getElementById("result"); var str = ""; for(var i=0;i<cadPhoto.length;i++)...{ childNodeList = cadPhoto[i].childNodes; urlNode = childNodeList[0].nodeTypedValue; altNode = childNodeList[1].nodeTypedValue; str = str+ "<img src='"+urlNode+"' onclick="alert('"+altNode+"')"/><br/>"; } resultDiv.innerHTML = str; }</script> <body onload="GetXMLNodeValue('NewFile.xml')"> <div id="result"> </div> </body></html><?xml version="1.0" encoding="UTF-8"?> <root> <productId> <cadPhoto> <url> image/1.jpg </url> <alt> ֢ˇµے»օͼƬ </alt> </cadPhoto> <cadPhoto> <url> image/2.jpg </url> <alt> ֢ˇµڶ�¬ </alt> </cadPhoto> <cadPhoto> <url> image/3.jpg </url> <alt> ֢ˇµۈ�¬ </alt> </cadPhoto> <cadPhoto> <url> image/4.jpg </url> <alt> ֢ˇµۋŕƍ¼Ƭ </alt> </cadPhoto> </productId> </root>