用指向图像放大版和target="_blank"
的href
将锚定标记中的图像包裹起来。
编辑:根据您的更新说明。
不直接链接到图像,链接到next.html#name_of_image.jpg
。然后,在加载next.html时,执行javascript以使用适当的图像填充目标div。
如:
<!--Include a placeholder image in your HTML in the target div...-->
<div id="target_div">
<img id="target_img" style="display: none;" src=""/>
</div>
<!--...And populate it on page load with Javascript.-->
<script type="text/javascript">
window.onload = function()
{
if (location.hash) //Only do this if there's an actual hash value.
{
var imgPath = 'path/to/images/directory/'; //Build the path to the images directory.
var imgName = location.hash.substring(1); //Get the name of the image from the hash and remove the #.
document.getElementById('target_img').src = imgPath+imgName; //Update the src of the placeholder image with the path and name of the real one.
document.getElementById('target_img').style.display = 'inline'; //Now that it has a valid source, reveal it to the viewer.
}
}
</script>
我这样做,它的作品,但我在此页面中我有一个div我想在next.html在特定的div – sajid 2011-12-22 09:44:15
打开点击缩略图页面next.html @ sajid啊,好的。没有汗水。检查我上面编辑的答案。 – Aaron 2011-12-22 20:37:20
亲爱的阿伦你的代码会做的是,我有100的图片和所有的图片,我必须附上一个HTML,并在每一个HTML我必须嵌入JavaScript代码这不是我需要动态的一些东西的解决方案 – sajid 2011-12-23 04:35:29