完全不用加事件啊,直接加个target就成了
比如document.writeln("<a target=\"_blank\" href=\"photo/photo"+photoIndex+".jpg\"><img src=\"sphoto/sphoto"+photoIndex+".jpg\" /></a>");
比如document.writeln("<a target=\"_blank\" href=\"photo/photo"+photoIndex+".jpg\"><img src=\"sphoto/sphoto"+photoIndex+".jpg\" /></a>");
打开大图片的页面还有其他的东西,我现在要提取相应的photoIndex值,传到另外一个页面,方便控制图片的显示
打开大图片的页面还有其他的东西,我现在要提取相应的photoIndex值,传到另外一个页面,方便控制图片的显示
谢谢
document.writeln('<a href="photo.asp?pp=photo/photo'+photoIndex+'.jpg" target="blank"><img src="sphoto/sphoto'+photoIndex+'.jpg" /></a>');
document.writeln("<a href=\"javascript:viewPic('photo/photo/"+photoIndex+"')\"><img src=\"sphoto/sphoto"+photoIndex+".jpg\" /></a>");
<script language="javascript">
function viewPic(name){
alert('MaxPic:'+name+'.jpg');
}
pageIndex=1;
switch(pageIndex)
{
case 1:
{
photoIndex=5;
for(var i=0; i<4; i++)
{
document.writeln("<a href=\"javascript:viewPic('photo/photo/"+photoIndex+"')\"><img src=\"sphoto/sphoto"+photoIndex+".jpg\" /></a>");
photoIndex+=1
}
break;
}
default:
{
photoIndex=(pageIndex-1)*pageSize+5;
for(var i=0; i<4; i++)
{
document.writeln("<a href=\"photo/photo"+photoIndex+".jpg\"><img src=\"sphoto/sphoto"+photoIndex+".jpg\" /></a>");
photoIndex+=1
}
}
}
</script>
谢谢~~~~~~~~~~~~~~~·
document.writeln(str);
<!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>
</head><body>
<script language="javascript">
switch(pageIndex)
{
case 1:
{
photoIndex=5;
for(var i=0; i<4; i++)
{
document.writeln("<a href=\"photo/photo"+photoIndex+".jpg\" onclick=\"showB('sphoto"+photoIndex+".jpg')\"><img src=\"sphoto/sphoto"+photoIndex+".jpg\" /></a>");
photoIndex+=1
}
break;
}
default:
{
photoIndex=(pageIndex-1)*pageSize+5;
for(var i=0; i<4; i++)
{
document.writeln("<a href=\"photo/photo"+photoIndex+".jpg\" onclick=\"showB('sphoto"+photoIndex+".jpg')\"><img src=\"sphoto/sphoto"+photoIndex+".jpg\" /></a>");
photoIndex+=1
}
}
}function showB(picName)
{
alert(picName);
}
</script>
</body>
</html>