首先下载JavaScript包: http://thecodecentral.com/wp-content/uploads/2007/08/yuilightboxwdep.zip //根据下载的JavaScript包修改以下的路径 ... <br><br>//加载 lightbox <BR>init = function()...{ <BR>//制作一个数据源,含原本图片 <BR>//用法: 图片ID: {url: "原本图片路径", title:"标题" } <BR>var dataSource = ...{ <BR>id_1:...{url:"image-big.jpg", title: '测试图片'} <BR>}; <br><br>//创建 Lightbox 对象: <BR>//用法: <BR>//imageBase: Lightbox.js 的路径 <BR>//dataSource: 数据源 <BR>var lightbox = new YAHOO.com.thecodecentral.Lightbox(...{ <BR>imageBase:'js/lightbox', <BR>dataSource: dataSource <BR>}); <BR>} <BR>//这行保持原貌 <BR>YAHOO.util.Event.on(window, 'load', init); <BR> //加一个预览图片 //用法: //注意:保持图片ID和数据源ID一致 代码无注解: <br><br>init = function(){ <BR>var dataSource = { <BR>id_1:{url:"image-big.jpg", title: '测试图片'} <BR>}; <br><br>var lightbox = new YAHOO.com.thecodecentral.Lightbox({ <BR>imageBase:'js/lightbox', <BR>dataSource: dataSource <BR>}); <BR>} <br><br>YAHOO.util.Event.on(window, 'load', init); <BR>