简体   繁体   English

单击我的HTML页面中的图像时的弹出窗口

[英]Pop-up window when clicking on an image in my HTML page

I know this question has been asked before, but mine is a little different. 我知道之前曾有人问过这个问题,但我的问题有所不同。

I know tthat to do a popup of a thumbnail i have to use Javascript and give te image location. 我知道要弹出缩略图,我必须使用Javascript并指定图像位置。 however, what i want to do is this; 但是,我想做的是

<IMG SRC="test.png" ALT="test1" WIDTH=32 HEIGHT=32 onclick="openWin(test.png)"></a> 

where test.PNG is a picture i just queried from the database in SQLPLUS. 其中test.PNG是我刚刚从SQLPLUS数据库中查询的图片。 i do not have a local copy and i do not know the path to id. 我没有本地副本,我也不知道ID的路径。 when i write the javascript function for this, i wrote: 当我为此编写JavaScript函数时,我写道:

<script language="JavaScript">

function openWin(img) {
    window.open(img);

}
</script>

however, i keep getting a URL\\image.png does not exist. 但是,我一直在获取URL \\ image.png不存在。 How can i get this working? 我该如何工作? it has to work for an arbitrary number of images, depending on how many actually meet the requirements of the query. 它必须处理任意数量的图像,具体取决于实际满足查询要求的数量。

the test.png does not actually exist, i wanted to see becuase it shows as a broken image icon in my table, but when i click on it, it says the URL does not exist. test.png实际上并不存在,我想查看一下它是因为它在表中显示为残破的图像图标,但是当我单击它时,它说URL不存在。

Screw Javascript. 螺丝Javascript。 You don't need Javascript for this. 您不需要使用Javascript。 Lose the 'onclick' and put 'target="_Blank"' in an 'href' tag around the 'img' tag. 丢失“ onclick”,并将“ target =“ _ Blank””放在“ img”标签周围的“ href”标签中。

Example: 例:

 <a href="YourLink" target="_Blank"> <img src="test.png" alt="Put something more exciting here." width="32" height="32" /> </a> 

All good? 都好? By the way, this isn't PHP, my friend. 顺便说一句,这不是PHP,我的朋友。 Hehe. 呵呵。 Wrong hashtag. 标签错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM